Hello to all, i have the following functions:
string File::readLine( ){
char ch;
string str;
ch = read();
while(ch != LF && ch != CR && ch != -1){
str.append(1,ch );
ch = read();
}
if(ch == -1){
cout << "this line could not be read" << endl;
exit(1);
}
//take care of situation where the loop exited with LF but
//on a system that has CR.
int tmp = file->tellg();
if(read() != CR){ //if no CR available on system, return the get
pointer to it's correct location.
file->seekg(tmp);
}
return str;
}
the function is executed correctly but in the end it skips the "return
str" line,
and tun flies with an error.
debugging took me to a qt class moc_myclass.cpp (it's a qt project in
eclipse)
to a line where it says "_id -= 1;"
inside a function called "int myclass::qt_met acall(...)"
can anyone help me??????????
string File::readLine( ){
char ch;
string str;
ch = read();
while(ch != LF && ch != CR && ch != -1){
str.append(1,ch );
ch = read();
}
if(ch == -1){
cout << "this line could not be read" << endl;
exit(1);
}
//take care of situation where the loop exited with LF but
//on a system that has CR.
int tmp = file->tellg();
if(read() != CR){ //if no CR available on system, return the get
pointer to it's correct location.
file->seekg(tmp);
}
return str;
}
the function is executed correctly but in the end it skips the "return
str" line,
and tun flies with an error.
debugging took me to a qt class moc_myclass.cpp (it's a qt project in
eclipse)
to a line where it says "_id -= 1;"
inside a function called "int myclass::qt_met acall(...)"
can anyone help me??????????
Comment