Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cout << "Please input the file to select first name from" << endl;
- char* filename1 = new char[80];//for name of file
- cin.ignore();//ignores past cin
- cin.getline(filename1, 80);//takes in the name
- char ** file1 = new char*[5];
- ifstream newFile1; //new file
- newFile1.open(filename1);//opens file with the name put in
- if (!newFile1) {//if file doesn't exist
- cout << "There was an error reading the file" << endl;
- }
- else {
- int i = 0;
- while (newFile1.eof() != -1) {//while not end of file
- newFile1.getline(file1[i], 80, ',');//gets line splitting over comma
- i++;
- }
- }
- newFile1.close();
- //newFile1.clear();
- char** file2 = new char*[5];
- cout << "Please input the file to select second name from" << endl;
- char* filename2 = new char[80];//for name of file
- cin.ignore();//ignores past cin
- cin.getline(filename2, 80);//takes in the name
- //ifstream newFile2; //new file
- newFile1.open(filename2);//opens file with the name put in
- if (!newFile1) {//if file doesn't exist
- cout << "There was an error reading the file" << endl;
- }
- else {
- int i = 0;
- while (newFile1.eof() != -1) {//while not end of file
- newFile1.getline(file2[i], 80, ',');//gets line splitting over comma
- i++;
- }
- }
- newFile1.close();
- //newFile1.clear();
Add Comment
Please, Sign In to add comment