So i was seeing a lecture on " inputs and outputs for online judge" and in that, the command line for giving input through an input file on the terminal was for Macbook, but as expected it did not work for windows. So i want to know the command line to give input through an input file on the terminal for windows.
How to take input through an input file for windows
hello @priyam04
put these lines in ur code , just after writing int main.
#ifndef ONLINE_JUDGE
// For getting input from input.txt file
freopen("input.txt", "r", stdin);
// Printing the Output to output.txt file
freopen("output.txt", "w", stdout);
#endif
and u dont have to do anything else.
just give input in ur input.txt file
run ur code , and result will get saved in output.txt file.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.