I have a issue with reading a text file in c++ that you already created within the program

Code works perfectly fine once you change int fromfile; //gets the integer from file. to std::string fromfile;. I do not understand how your compiler did not complain about it. As other answers say, it is best practice to not have file open multiple times but that is not issue in your case.

Leave a Comment