I am trying to run a C++ program and redirect the console output to a text file. From my understanding, this is achieved by:
./program > console.txt
I am able to compile and run the program using ./program
fine and get the console output I am expecting. When I run ./program > console.txt
nothing happens, I simply enter a linebreak and am on a new line in my console input (looks like the following)
$ ./program > console.txt
I have also tried append instead of redirect using ./program >> console.txt
, as well as ./program | tee console.txt
.
I know I can alter the C++ program to write to a file using <fstream> but I'd like to figure out why the redirect is not starting the program.
Thanks in advance!