I am not going to type in all my code, but when I run the program it reads the last char twice.How can I fix it thank you
Code: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; }




Reply With Quote