Output to a file

Andy_Hay83
Andy_Hay83 used Ask the Experts™
on
I have just finished my uni assignment and am writing up my report. I need to include a copy of the output when I run the prgramm. Unfortunatley, the program runs in MSDOS and I don't think I can scroll back up an MSDOS page to copy the output - can I? Failing that, can I just write the output to a file? - if so how and is it easy????

Regards
Andrew Hay
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I am using wedit win32 v3.3

Author

Commented:
Not really what I'm looking for. All I want to do is include the output from my c program is a word document. Can I write the output to a file and paste it into a wrod document. How do I wrie the output to a file. The above link is way to complicated for me! Thanks anyway

regards
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Not really what I'm looking for. All I want to do is include the output from my c program is a word document. Can I write the output to a file and paste it into a wrod document. How do I wrie the output to a file. The above link is way to complicated for me! Thanks anyway

regards
Andy, I think what you want to redirect the output of your program to the file. From the msdos prompt here is what you do:

myprog > output.txt

What you are doing with the command above (>) is redirecting the output of your program which goes to stdout(the screen), to a file called output.txt. So to sum it up, the file output.txt will contain the information that your program would print to the screen.  If your program takes in parameters make sure you include them in the command above, for example:

myprog param1 param2 > output.txt
You can also copy and paste in an msdos screen by right clicking on the title bar of the msdos screen, selecting edit, then selecting mark.  Then highlight the information that you want to copy and press enter.  Now you can copy anywhere you want to.

Commented:
in addition to redirection...
 take a screen shot .. that will look more authentic ..
output file can be easily typed in manually .. even if ur program doesnt really work...
i hope u know how to take it..
:P

Commented:
and what abt someone making video shoot of, u and ur comp-screen while  u r doing all the stuff on computer .. :D

Commented:
Dear friend,
if u r programing in C or C++ do following :
open a file in which u want to take output by
FILE * fp = (FILE *) fopen("output","w");

and use fprintf(fp,format,args) like fprintf(fp,"%d",99285);

At the same time open another window and print output file's changes or just print the file so u can also see output of ur program.

If all this things r complex for u switch to UNIX/LINUX and use wine programm to execute MS-DOS programs.
In Unix/Linux redirection of output is easy.
Top Expert 2006

Commented:
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:
PAQed with A grade to HelpMeImStupid

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Sunny
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial