A r t i c l e s
Redirecting STDOUT To Text File
Redirecting standard out on the command line to a text file is not so hard if you know about the OUTPUT global variable which you can take control of.
procedure RedirectSTDOUT(FileName: string);
// close(OUTPUT); //closes STDOUT, actually doesn't seem to be needed.
Assign(OUTPUT, FileName); // now assign a file to STDOUT (redirect)
Rewrite(OUTPUT); // open file for writing
close(output); // close file
Assign(output,''); // restore STDOUT mode
rewrite(output); // open STDOUT for writing
WriteLn('This text is written to console');
writeln('This text is written to Error.txt');
// want to restore std out?
WriteLn('Back to console again');
Note: This Wiki is outdated, personal views may have changed.
This wiki contains info on life, health, humans, nature, programming, database, fads, paradigms, poems, principles, theories.
Articles may contain statements which some may find helpful and encouraging, or even discouraging.
Beware, I believe in the Grand Justice system.