C++ string array from ifstream
- by David Beck
I have a program that I need to read in an array of strings from a file. The array must be C type strings (char * or char[]).
Using the following code, I get a bad access error:
for (i = 0; i < MAX_WORDS && !inputFile.eof(); i++) {
inputFile >> words[i];
}
words is declared as:
char *words[MAX_WORDS];