I'm trying to load files from a folder and I have a directory name that I push back into the vector then it appends the name of the character to load, and it gets the first one but not the second Here is the code:
$Player2.png is supposed to appear like the first line, but instead its appended to the first so how do i fix this? I have been struggling with it for at least a day.
these are not needed when you have while(getline(loadCharacters, gameVars.characterName)) since the getline will return a std::ifstream & which will invoke operator bool when it checks the conditions. The bool will return false if there are any bad bits/fail bits/eof bits set. http://www.cplusplus.com/reference/ios/ios/operator_bool/
As far as the error before line 12 you should set the string back to the default value charDirectory = "Resources/Characters/";. By the way you could also use the +/= operator to append. Something line this: