hi:
i defined an input file stream, and its acting fine on some files, but strange on one file.
i'm using this code:
1 2 3 4 5 6 7
|
...
ifstream in;
in.open("something");
in.get();
in.seekg(-1,ios::cur);
in.get();
...
|
i'm using the debugger that came with the VS2010 to determine the values returned by each function.
this is a normal file, as appeared in my hex editor:
offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000 00 00 0D 20 00 00 1B ... ...
|
this file is a subset of the original file, means the first few bytes of the original file are the same in this one, but the original has more values.
the program works fine on this short version of the file, but the problem appears when i use the big file:
1 2 3 4 5 6 7
|
...
ifstream in;
in.open("something");
in.get(); //this returns 0x00.
in.seekg(-1,ios::cur); //returns 0x01
in.get(); //this should return 0x00, instead, it returns 0xffffffff.
...
|
here's what i found:
it's not an eof problem, i spread several calls to eof() around this code and it returned false.
it's not a file size problem, the original file contains only 1000 values, and in my search i discovered that the file size limit is way over that(unless each value is
2,147,483 bytes long).
i searched if ifstream::get() returns something strange when it finds null, but found nothing.
in a thought, can it be the file system, i'm using NTFS win7 64bit.
i thought to my self (it's time for a professional's advice).
i'd really appreciate the help, as i spent 10 hours searching.