J
Jason Heyes
I want to open a file with a known location and process its contents. The
contents are to be treated as a list of pathnames. Each pathname is an
absolute or relative pathname in the following sense:
- the current directory is the directory of the opened file
- the root directory is the program directory (i.e., working directory of
the program under execution)
A pathname is processed by opening a file and displaying its contents. The
location of this file is specified by the pathname in either absolute or
relative form.
I worked with a friend to come up with the main function:
#include <iostream>
#include <string>
void process_file(std::string name);
int main(int argc, char **argv)
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
return 1;
}
process_file(std::string(argv[1]));
return 0;
}
We don't know where to go from here. Any advice or code is appreciated.
contents are to be treated as a list of pathnames. Each pathname is an
absolute or relative pathname in the following sense:
- the current directory is the directory of the opened file
- the root directory is the program directory (i.e., working directory of
the program under execution)
A pathname is processed by opening a file and displaying its contents. The
location of this file is specified by the pathname in either absolute or
relative form.
I worked with a friend to come up with the main function:
#include <iostream>
#include <string>
void process_file(std::string name);
int main(int argc, char **argv)
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
return 1;
}
process_file(std::string(argv[1]));
return 0;
}
We don't know where to go from here. Any advice or code is appreciated.