Can some one please tell me the problem with this code. I am reading each line using getline function and again using the same function for splitting the string for : delimiter.
string line,item;
ifstream myfile("hello.txt");
if(myfile.is_open()) {
string delim =":";
while(!myfile.eof()) {
vector<string> tokens;
getline(myfile,line);
stringstream iss(line);
while(getline(iss,item,delim)) {
tokens.push_back(item);
}
}
myfile.close();
}
The error message is:
C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : expects 2 arguments - 3 provided 1> c:\program files\microsoft visual studio 8\vc\include\string(528) : see declaration of 'std::getline'