Yarden
Yarden

Reputation: 25

File inputs&outputs

Hey everyone. I have an exe file that runs a console program that was programmed in C.

during the run of the program the user is asked to enter numbers (using the scanf function). and the output is being printed to the screen by printf.

The thing is this. I want to make my own txt file with inputs and I want the program to use those inputs. I also want that the output will be printed to a different txt file - and not in the command window (or in addition to the command windows - I don't care if it's both).

how can I do that, in c#? or can I create a *.bat file that will do that? - that would be best.

Another question: Is there a way to create a *.bat file that will check if two txt files are the same?

Thanks!

Upvotes: 0

Views: 139

Answers (1)

JeffFerguson
JeffFerguson

Reputation: 3002

Assuming that the program was written to read from stdin (standard input) and write to stdout (standard output), you should be able to use the following command line:

program.exe < input.txt > output.txt

Upvotes: 1

Related Questions