How can I read a filename from the command line and utilize it in my C++ code file?
ex: ./cppfile inputFilename outputFilename
Any help is greatly appreciated!
How can I read a filename from the command line and utilize it in my C++ code file?
ex: ./cppfile inputFilename outputFilename
Any help is greatly appreciated!
int main(int argc, char** argv) {
string inFile = "";
string outFile = "";
if( argc == 3 ) {
inFile = argv[1];
outFile = argv[2];
}
else {
cout << "Usage: ./cppfile InputFile OutputFile\n";
return 1;
}
...
}