954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Save C program output file in batch file

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?

Euphobia
Newbie Poster
2 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

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

Euphobia
Newbie Poster
2 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: