   problem with strings (maybe)
  To initialize a class i use a txt file. something like this:States::States(){ifstream File;    File.open ("States.txt");int i = 0;while (!File.eof()){    File>>States::State>>States::Anim>>States::ctrl>>States::Velx>>States::Vely>>States::Accelx>>    States::Accely>>States::Type>>States::NextState;i++;}File.close();};a line in States.txt would look like this:45  45 0  0 -5 0 0.25  2  46the data members are either int or float, and this way worked perfectly.Then since i will need to treat text in another class anyway, i thought i would change one of the values in the txt file to actual text, not only to exercise but also to make the txt file more readable to me. the above line now would look like this:45  45 0  0 -5 0 0.25  A  46The penultimate value would carry either a S, a C or an A. (they stand for stand, crouch, air).States constructor would change like this:...#include <string>...States::States(){ifstream File;    File.open ("States.txt");string type;int i = 0;while (!File.eof()){File>>States::State>>States::Anim>>States::ctrl>>  States::Velx>>States::Vely>>States::Accelx>>  States::Accely>>type>>States::NextState;if (type == "S")States::Type = 0;else if (type == "C")States::Type = 1;else if (type == "A")States::Type = 2;i++;}File.close();};States::Type determines what kind of hitbox a certain animation gets amongst other things.Now that kind of worked, but with something funny: the very first element(with index 0) would get the hitbox type of the last element in the file(so changing the last element type will give another result). Even better, this happens only when i run the program without debugging. When i run in the debug mode everything is fine, just like with the 1st method.That's about it. since i never really used strings i'm tempted to believe the error is because of them, although i don't really know at this point. Not to mention that it works in debug, making it useless.Can someone help?
  .eof() only becomes true after you try to read after the EOF. That is, you have to detect the EOF after attempting to read, but before applying the results of your reading. In short:while (File){  // Read into temporary  if (!File) break;  // Copy temporary to array}   ;  Many thanks! That solved it!   