how do i get output which would normally appear on the screen, as in the Microsoft visual studio command prompt, written to a file such as a simple text file. say << X << is the output, what do i do from here? thanks
pjh-10 0 Light Poster
Recommended Answers
Jump to PostFILE *stream ; //Redirect Output from console to a TextFile
if((stream = freopen("C:\Somefile.txt", "w", stdout)) == NULL)stream = freopen("CON", "w", stdout); //Redirect Output to the Screen
Jump to PostThat would go anywhere that you want stuff to print to and from the screen.
Example:
if you wanted to get everything written to the console into a file.. you can do:
FILE *stream ; //Redirect Output from console to a TextFile if((stream = freopen("C:\Somefile.txt", "w", stdout)) …
Jump to PostI'm just not sure the following statement will work with a full path
ofstream out("Z:\mp3.txt");
Why don't you try the following...
ofstream out("mp3.txt");
All 12 Replies
Labdabeta 182 Posting Pro in Training Featured Poster
pjh-10 0 Light Poster
Labdabeta 182 Posting Pro in Training Featured Poster
pjh-10 0 Light Poster
pjh-10 0 Light Poster
triumphost 120 Posting Whiz
pjh-10 0 Light Poster
pjh-10 0 Light Poster
triumphost 120 Posting Whiz
pjh-10 0 Light Poster
pjh-10 0 Light Poster
BobS0327 24 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.