Re: Offset by 1 in CStdiofile Seek while reading 0xa
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Thu, 8 May 2008 07:50:48 -0400
"Ganga Sridhar" <gangasridhar@xxxxxxxxxxxxxxx> wrote in message
news:uY1ds3MsIHA.484@xxxxxxxxxxxxxxxxxxxx
In my VC++ program I am reading a file in text mode using CStdioFile.
I am trying to read the file character by character until I encounter
the token (Decimal 10 / 0xa)
CStdiofile and Seek(nBytes,CFile::current);
where nByte = 1
Now when I try to read the next character after 0xa, I find that the
offset has moved 1 byte extra.
For eg.
BG*test*test2*12345*1326*9150
GS*mytest*test4
Before GS the file contains 0xa (when viewed in hex editor)
Now when I try to read the next character after 0xa , I get 'S'
instead of 'G'
I don't quite follow. After you've read the end-of-line character, the
file pointer is positioned at G. You seek by one byte, so the file
pointer is now positioned at S. Why again do you expect to read G? Why
do you feel you need to seek in the first place?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: Offset by 1 in CStdiofile Seek while reading 0xa
- From: Ben Voigt [C++ MVP]
- Re: Offset by 1 in CStdiofile Seek while reading 0xa
- References:
- Offset by 1 in CStdiofile Seek while reading 0xa
- From: Ganga Sridhar
- Offset by 1 in CStdiofile Seek while reading 0xa
- Prev by Date: Re: Visual Studio 2005 x64 mode.
- Next by Date: Re: C2664 on initializing auto_ptr with const patam in constructor
- Previous by thread: Offset by 1 in CStdiofile Seek while reading 0xa
- Next by thread: Re: Offset by 1 in CStdiofile Seek while reading 0xa
- Index(es):
Relevant Pages
|