problem using getline function

Joined
Mar 21, 2010
Messages
2
Reaction score
0
I am trying to create a function in my c++ program which reads in strings from a file and assigns them to a variable then passes these variables into an object constructor which is then added to a vector<object>. So far this is what I have:

ifstream load;
string s1="",s2="",s3="";
load.open("myFile.txt");
while(! load.eof())
{
getline(load, s1, " ");
getline(load, s2, " ");
getline(load, s3, " ");

Object newObj(s1,s2,s3);
list.push_back(newObj);
}
load.close();




The error i keep getting is an invalid conversion from void* to char** This error seems to occur in the getline function's second parameter. I am a little new to c++ programming and I am not sure what parameters are supposed to be passed to it. the file it is reading from has every variable separated by a single space.
Any help will be greatly appreciated.
Thanks.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top