in a program i need to make one of the requirements is to open the program along side the executable using the terminal and c++:
./program.exe FILENAME.txt
i can get the program to open the .txt file inside of the program so the user doesnt have to type the file name but it is not what is needed. i already included the fstream library in my program.
thank you in advance to anybody who can help me out.
int main(int argc, char* argv[])
{
if (argc < 2) return 1;
ifstream fin(argv[1]);
//fin is now an object like cin, except that it uses the file as a buffer.
return 0;
}