1234567891011121314151617181920
void main() { ifstream fin; ofstream fout; string temp; char* pch; char* array[100]; int count= 0; fin.open("tvshows.dat"); if(fin.fail()) { cout << "Could not open" << endl; exit(1); } while(!fin.eof()) { fin>>temp; pch = (char *) malloc(sizeof(char) * temp.size()); strcpy(pch, temp.c_str()); array[count++] = pch; }
12345678
while(!fin.eof()) { break(); fin>>temp; pch = (char *) malloc(sizeof(char) * temp.size()); strcpy(pch, temp.c_str()); array[count++] = pch; }
123456789101112
while( ! fin.eof() ) { fin >> temp; if( fin.eof() ) break; /* (The rest as you have it) */ } /* while( ! fin.eof() ) */