hi...
im newbies in C...
ive got a problem hope ur guys please take a look at it...
line - registered as stringCode:int main () { string line; char line1[60], c[] ="object Class" ; ifstream myfile ("example.txt"); if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); //--->problem here line1 = line; if (line1 == line2) {cout << line2 << endl;} } myfile.close(); } else cout << "Unable to open file"; return 0; }
line1 - registered as char with size of 60
line2 - is char "object Class"
error - Error E2277 test6.cpp 15: Lvalue required in function main()
how can i compare line and line2?
how can a string (line) can be converted to char (line1)?
really need help...
shatred



LinkBack URL
About LinkBacks


