why such two easy lines don work
char c;
while(!file.eof ())
{ file.read(c,1); cout<<c; }
the loop is infinite i don know why the eof bit is not set or what
|
Team Leader
|
![]() |
| 6Oct2007,15:03 | #2 |
|
You don't show how you're opening the file, so the fail bit is probably set, which means the eof bit will not be set. If you care to show some more code, feel free to do so.
If you show more code, and want a response, put the code in code tags. |
|
Go4Expert Member
|
|
| 6Oct2007,19:59 | #3 |
|
Code:
string str2="test.txt"; ifstream file(str2.c_str (),ios::in); Code:
while(file.tellg()<=lastEnd)
{
file.getline (temp,20,'=');
if (strncmp(temp,varName.c_str(),varName.length())==0)
{
file.getline (X,20);
return true;
}
file.ignore(30,'\n');
}
|
|
Team Leader
|
![]() |
| 7Oct2007,08:09 | #4 |
|
Are you paying attention, and have you bothered to read the documentation for the functions you use?
|
|
Go4Expert Member
|
|
| 7Oct2007,19:29 | #5 |
|
i already did, but i don remember any thing telling me the code i sent is wrong.
thanks 4 help |

