Stringstream into object

I have a file that shows the assigned number of a person, their name, correct answers and wrong answers on the form "4 Marie 30 8". I'm trying to read this into an object looking like this:

1
2
3
4
5
6
7
Keeptrack::Keeptrack(int a,string b,int c,int d)   
{
    assnum=a;
    pername=b;
    corrnum=c;
    errnum=d;
}


And this is the actual code for the reading:
1
2
3
4
5
6
7
8
9
10
ifstream textlog("personalinfo.txt");

istringstream ss;
getline(textlog,first);
ss.clear();
ss.str(first);
ss>>a>>b>>c>>d;
s1 = new Rum(a,b,c,d);

textlog.close();


first, a, b, c, and d are all declared locally.
Why don't you read directly from the file stream?
And I wish people would their variables proper names - it is starting to bug me now
What do you mean? Like _1, _2, _3, _4?
Also, what's a Rum? I'm seeing a Keeptrack constructor, above.
Topic archived. No new replies allowed.