I have a quick question:
I have a C++ program that prompts the user for inputs, accepts those inputs, does things based on the inputs, and displays the results (everything is being displayed to the shell window using printf). I want to take everything that is being displayed in the shell window and instead write it to a file. If I could make it display in the shell window and also write to the file, that would be even better. Here is what I attempted to do:
program.out>programresult.txt
I also tried:
program.out>>programresult.txt
Both of these commands do absolutely nothing. The cursor just goes to the next line and sits there (without even a command prompt). The .out file does not run at all. Please help me do this, or let me know if it cannot be done. Thank you.
P.S. The file 'programresult.txt' is created in the directory, but the file is empty.
fflush(): printf("Type user input now: "); fflush(stdout); fscanf(...); – nobar Feb 26 '11 at 19:34