Not sure this is the right place to put this.

I have a batch file for a program that I'm writing, which takes a C source file, compiles it and runs it, and then tries to save the output of it to a .txt file.

The program lets a user enter some C code, and then when the compile button is pressed, it compiles the code, and prints out the output in the same program. It works fine for programs that require no user input, such as a simple "Hello, world" program, but when input is required, the window that displays the output appears before the compiled program has finished running as the program is still waiting for input.

I think I know what the problem is, if I just have in my batch file "test", this loads whatever program is saved as test.exe and shows me the command prompt with the program, but if I put "text > output.txt", no command prompt is shown, so I can't enter anything when needed to. Is there a way to redirect to a text file, but still through command prompt?

8 Years
Discussion Span
Last Post by Euphobia

Marking this as solved, found I'd need to use something like piping to achieve what I want.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.