I am trying to to save output console in a text file in visual studio 2015 for a console c program. I right click the Project>Properties>Configuration Properties>Debugging>Command Argument and type there
> output.txt
to save the console in text file. But after I do this program doesn't ask for any inputs and the output console just keeps on with blinking underline. If I remove this, program starts working normally. When I check, file output.txt is there but without anything in it.
It works when I give input from a file by adding <input.txt >output.txt
while this is more desirable I prefer not to do as inputs are not visible in console.
When I try to run using 1&2>out.txt
program executes , but the file is again empty.
I have tried using VS2019 same problem. I also tried changing platform from Win32 to All.
I even tried making batch file as follows
@ECHO OFF
for /r %%x in (*.c) do cl "%%x"
for /r %%x in (*.exe) do (
"%%x"
>"%%x".txt
clear
)
PAUSE
Any clue where I am doing it wrong ?