Let's say you make a console application and enter stuff in it and stuff like
cout<<"Enter emergency: "
balal balal bla
bala
then u want to save this fast in .txt form or whatever form into ur computer so u can check later. Is there anyway?
Let's say you make a console application and enter stuff in it and stuff like
cout<<"Enter emergency: "
balal balal bla
bala
then u want to save this fast in .txt form or whatever form into ur computer so u can check later. Is there anyway?
when you execute the file redirect the output into a file like so
runprogram.exe > file.txt
can u give that in code form cuz i dont get it
You can, at anytime, read the entire contents of the console screen and if you wish, write it to a file so next time you open the application it will start with the self same screen.
My console tutorial here covers this, the section towards the end of page 2 will give you ideas.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
i couldnt get anything
i was referring to when you run the program from the command line..Originally Posted by ekweb
eg.
c:\myprog.exe > c:\output_file.txt
> works same way in nix..
is that the result you were looking for?
the problem with xhi's solution is that ALL screen output will go to a file, so if you are prompting someone to enter something that prompt will also go to a file and you will never see it on the screen. I doubt that is what the wkweb really wants. He didn't really say, but I suspect he wants to save it to a file AFTER typing the data on the keyboard.
Use fstream to save the contents of program variables to a file and read them back in another session of the program.
i was drawing that conclusion from the fact he never asked about file IO, specified that he wanted a *fast* solution and also only had a cout in the example code..
well its something for beginners lets say instead of opening a notepad u open the console application exe and write something and press enter. The info u write i want saved on desktop or where ever in .txt or console or watever. I think now u know what i mean. I hope. Really basic but im a beginner which is y i ask ur help. TY
in that case as Ancient Dragon suggested, research on fstream..
k ill check