So i'm trying to understand command line arguments in c++ testing them out on this program:
#include <iostream>
int main(int argc, char* argv[])
{
std::cout << "There are " << argc << " arguments:\n";
// Loop through each argument and print its number and value
for (int count{ 0 }; count < argc; ++count)
{
std::cout << count << ' ' << argv[count] << '\n';
}
return 0;
}
When I type this into the terminal
./a.out hello world file.txt
I get
There are 3 arguments:
0 ./a.out
1 hello
2 world
3 file.txt
But when I type this into the terminal
./a.out hello world <file.txt
I get
There are 2 arguments:
0 ./a.out
1 hello
2 world
where is the file.txt arguemnt goin and how do I use it?