c++code < input.txt
This will execute the c++code program and redirect stdin from input.txt, so instead of you entering the input the program will get it's input from the file input.txt. You can use std::cin to read the input.
You will not get any command line arguments because your file will arrive through std::cin.
1 2 3 4 5 6 7 8 9
int main() // no need for parameters
{
// file is read using std::cin
std::string line;
std::getline(std::cin, line); // read one line from input file (input.txt)
return 0;
}
You can compile the code like this:
1 2 3
g++ -o myprogram myprogram.cpp // Linux
g++ -o myprogram.exe myprogram.cpp // Windows
Many options have long names starting with -f or with -W---for example, -fmove-loop-invariants, -Wformat and so on. Most of these have both positive and negative forms; the negative form of -ffoo would be -fno-foo.