#include <iomanip>
then you can use the getline() function.
getline(ostream, destination , 'd');
ostream = the input stream you are using, in this case 'fin';
destination = where you want the data to go, in this case h[i];
'd' = a character delimeter, whatever you want, can be '|'
1 2 3 4 5 6
|
for (i=0;i<10;i++)
{
getline(fin, h[i].name , '|'); //reads in the name
fin >> h[i].score; //reads in the score
fin >> ws; //reads past whitespace and other unuseable characters (newline) in the txt file.
}
| |
something like that might work.
if you do it like this then your txt file should look like
name1|score1
name2|score2
name3|score3
etc...etc...
and the filewriter should be....
fout << h[i].name << "|" << h[i].score << endl;
sorry I couldnt help you debug the code you allready had.