Create a folder for the project and create a C++ file called email_parser.cpp. Since this application will read files and process strings, add includes for the appropriate libraries and add code to take the name of a file from the command-line:
#include <iostream> #include <fstream> #include <string> using namespace std; void usage() { cout << "usage: email_parser file" << "n"; cout << "where file is the path to a file" << "n"; } int main(int argc, char *argv[]) { if (argc <= 1) { usage(); return 1; } ifstream stm; stm.open(argv[1], ios_base::in); if (!stm.is_open()) { usage(); cout << "cannot open " << argv[1] << "n"; return 1; } return 0; }
A header will have a name and a body. The body could ...