You may be reading data from your file, in a way that you aren't intending to.
The function std::getline take two arguments, not three:
http://www.cplusplus.com/reference/string/string/getline/
Are there any spaces in your text file? or newlines?
An option would be to read a line from the file, then parse it into your three variables.
You can read a whole line with this:
1 2
|
string temp;
getline(myFile, temp);
|
Then you could simply parse it (hopefully you've learnt this) and store it into the three variables.
Parsing:
-Find the index of the delimiter, in your case ',' and copy the substring from index_start to the delimiter, exclusive of delimiter. Then set index_start to your delimiter plus 1 so you don't include it.
substr take two arguments:
http://www.cplusplus.com/reference/string/string/substr/
You should know the strings length.
http://www.cplusplus.com/reference/string/string/length/
String reference:
http://www.cplusplus.com/reference/string/string/