![]() |
| | #1 |
| Registered User Join Date: Jan 2006
Posts: 5
| Saving a Console Application!! 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? |
| ekweb is offline | |
| | #2 |
| !anExpert Join Date: Mar 2005 Location: pa
Posts: 155
| when you execute the file redirect the output into a file like so runprogram.exe > file.txt |
| xhi is offline | |
| | #3 |
| Registered User Join Date: Jan 2006
Posts: 5
| can u give that in code form cuz i dont get it |
| ekweb is offline | |
| | #4 |
| It's full of stars Join Date: Aug 2001
Posts: 4,833
| 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. |
| adrianxw is offline | |
| | #5 |
| Registered User Join Date: Jan 2006
Posts: 5
| i couldnt get anything |
| ekweb is offline | |
| | #6 | |
| !anExpert Join Date: Mar 2005 Location: pa
Posts: 155
| Quote:
eg. c:\myprog.exe > c:\output_file.txt > works same way in nix.. is that the result you were looking for? | |
| xhi is offline | |
| | #7 |
| Registered User Join Date: Aug 2005
Posts: 1,265
| 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. |
| Ancient Dragon is offline | |
| | #8 |
| !anExpert Join Date: Mar 2005 Location: pa
Posts: 155
| 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.. |
| xhi is offline | |
| | #9 |
| Registered User Join Date: Jan 2006
Posts: 5
| 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 |
| ekweb is offline | |
| | #10 |
| !anExpert Join Date: Mar 2005 Location: pa
Posts: 155
| in that case as Ancient Dragon suggested, research on fstream.. |
| xhi is offline | |
| | #11 |
| Registered User Join Date: Jan 2006
Posts: 5
| k ill check |
| ekweb is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Win32 Console Application Problem. | kevinawad | C++ Programming | 10 | 11-07-2008 03:35 PM |
| console application... | k1ll3r | C++ Programming | 4 | 05-23-2006 10:41 AM |
| 'No symbols Loaded'. Simple console application | flipflop82 | C++ Programming | 3 | 10-20-2004 09:10 AM |
| making a stealthy win32 console application? | killdragon | C++ Programming | 3 | 09-08-2004 02:50 PM |
| Move cursor in console application | alfa | C# Programming | 2 | 02-09-2003 02:58 PM |