2
votes

I wrote a very simple code using qtcreator It's a console application and I want to set up input and output text file, so qtcreator get's inputs form input file(not console) and save the output in output file is there any kind of option in qtcreator that can specify input and output file

1
Do you mean you want to replace stdin and stdout data (reading from / writing to console by default) by file input / output?galinette

1 Answers

2
votes

If your program is already working by reading from console and writing to console using stdin and stdout, you just have to use console redirects.

You need to start your program from a command line using :

echo input.txt | myprogram.exe > output.txt

(windows)

cat input.txt | myprogram > output.txt

(unix)

Unfortunately, there is no possibility to redirect stdin and stdout from Qt Creator run options, AFAIK. You have to start the program yourself from the command line