Posted by Amit Nithian on April 14, 2001 at 16:13:40:
In Reply to: Re: log? posted by Ricky Castles on April 14, 2001 at 15:36:28:
: I don't want to beat a dead horse, I know this has been discussed a lot on this board. Apparently we are supposed to code everything just like all output is going to the screen using cout, but somehow it will be redirected to a log file. I am not clear as to how that redirection to the file is accomplished. It appears to me that it is a command line argument when the program is invoked, but I am not exactly clear. Is there something we need to do in our code to override cout to print to that file specified. Pardon my ignorance.
: : The program as specified takes one argument, the input file. The redirection is done by the O.S., so you'll never see the rest of the command line. Just write the program and output everything to cout; where the output ends up will be taken care of by the user.
This confused me too until I saw that little '>' This is a DOS/UNIX thing (at least I think it's UNIX too). If you don't know what it does open a command window and do
and then open c:\dir.txt in notepad and boom.. you will see in that file what you would have seen on your screen had you have done 'dir' without redirection. This is exactly what will happen with our project. The '>' is an OS thing and output to the screen will be re-directed to a file.
Believe me.. it makes life easier.. just ignore it.. don't worry about it b/c if it outputs to cout correctly, then you are fine.
Post a Followup