B
Bill David
Guest
I use Low Level I/O API (_open) to create a binary file. Then I use
_chsize to set the size of this file (a big size). And then I _open
this file for reading (get fd1), and _open it for writing (get fd2)
and _write something to it. After that, I _read something from the
beginning with fd1, but find:
1.I have written 65535 bytes to the file; (with fd1)
2.But I can only read 126 bytes out with the 3rd parameter as 1024.
(with fd2)
Is it possible? How to avoid it?
Note:
1.Everything should have been done in a single thread.
2.I am writing an extension for another product, I must use fd
instead
of FILE* that's why I use Low Level I/O API instead of buffered FILE
I/
O.
3.the following is part of my log:
CStreamFileAccessor checkStatus, data length=65535. -
CStreamFileAccessor checkStatus, written bytes=65535. - --
>result
of write with fd2
CPlainFileAccessor updateStatusRecord, blockId=1,nBlocks=1. -
CStreamFileAccessor call ::read,
iHandle=3,uOffset=0,nBytes=1024. -
-->request for 1024 bytes
CConcreteFileAdaptor after reading, nCount=126. - --
_chsize to set the size of this file (a big size). And then I _open
this file for reading (get fd1), and _open it for writing (get fd2)
and _write something to it. After that, I _read something from the
beginning with fd1, but find:
1.I have written 65535 bytes to the file; (with fd1)
2.But I can only read 126 bytes out with the 3rd parameter as 1024.
(with fd2)
Is it possible? How to avoid it?
Note:
1.Everything should have been done in a single thread.
2.I am writing an extension for another product, I must use fd
instead
of FILE* that's why I use Low Level I/O API instead of buffered FILE
I/
O.
3.the following is part of my log:
CStreamFileAccessor checkStatus, data length=65535. -
CStreamFileAccessor checkStatus, written bytes=65535. - --
>result
of write with fd2
CPlainFileAccessor updateStatusRecord, blockId=1,nBlocks=1. -
CStreamFileAccessor call ::read,
iHandle=3,uOffset=0,nBytes=1024. -
-->request for 1024 bytes
CConcreteFileAdaptor after reading, nCount=126. - --