I am having trouble loading the txt data into my array with the getline function.
[code]
/* Global Headers*/
#include <iostream> // include standard I/O library
#include <fstream> // opening and closing files
#include <cstdlib>
#include <string> // set string class
const int NUM_GUESTS = 25 ; // number of guests on list
const string BLANKS = " " ; // input spacing
std::string guestlist[NUM_GUESTS]; // array
int count; //for counter
cout<< ("This file is unaccessable at this time!")<< endl;
exit (1);
}
else
cout<< "file open" << endl;
return;
}
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
// read from file and build list//
void ReadFile(ifstream& inFile)
//close file
inFile.close();
return;
}
[code/]
I don't know how to construct a getline that will read the file into the array so that I can build a parallel array to compare with the names in the original
array.
ljrobison would the for loop read white spaces the list is for 25 guests first and last names.I tried
a for loop earlier and got cout that looked like this
John
Hughes
Hugh
Jackman
Every White space skipped line does the get line in your code solve this issue
Thank You so much for the time