I have some code Which is supposed to open two .dat file at the same time and eventually load the files over to a method to deal with them. I am not sure how to load the two files in using the code I have been given. I will show below.
This is my main
int main(int argc, char** argv)
{
// Start main class with command-line args
GPXport run(argc, argv);
return 0;
}
This is the code part to load in the files.
ofstream output;
// Open files
file_one.open(argv[1]);
file_two.open(argv[2]);
output.open(argv[3]);
if (! file_one) {
cout << "Error reading: " << argv[1] << endl;
} else if (! file_two) {
cout << "Error reading: " << argv[2] << endl;
} else if (! output) {
cout << "Error creating: " << argv[2] << endl;
} else {
cout << "Master: " << argv[1] << endl <<
"Slave: " << argv[2] << endl <<
"Output file: " << argv[3] << endl;
}
Now the problem is, I do not understand the argv and argc situation. How do i get the two file locations to this code?
Thanks
Edit---
I also have this before the second part of the code..
GPXport::GPXport(int argc, char **argv)
{
using namespace std;
if (argc != 4) {
cout << "Usage: ./gpsfix_cpp <master> <slave> <output>" << endl;
exit(1);
}