|
From: Lorenzo <co...@in...> - 2001-03-14 08:22:29
|
I have tried this program:
streampos here;
char buff[256];
ifstream in("test.txt", ios::in);
in.getline(buff, 255, '\n');
here = in.tellg();
in.close();
printf("%s\n", buff);
in.open("test.txt", ios::in);
in.seekg(here);
in.getline(buff, 255, '\n');
in.close();
printf("%s\n", buff);
and its result is:
line1
2
Instead of:
line1
line2
The file test.txt contains:
line1
line2
line3
line4
How can resolve this problem?
Thanks
|