to pass myFile as an argument i've got to do the follwong changes right??:
its giving me an error in the .h file, where i got:Code:void linklist::readfile() { ifstream myFile("textfile.txt"); readnum(myFile); cout << "All the data has been read from the file." << '\n'; cout << "Press Enter to continue!" << '\n'; getch(); } void linklist::readnum(ifstream filename) { if(myFile) { int s; if(!myFile >> s) return; readnum(); this->additem(s); // Number read first will be added last } myFile.close(); }
void readnum(ifstream filename);




Reply With Quote