Hi all,
This is my first post here.

I'm currently working with some files API related. There is a little thing that i don't understand, what is this parameter for API file: lpNumberOfBytesRead

Here's the structure of CreateFile:

BOOL ReadFile(

HANDLE hFile, // handle of file to read
LPVOID lpBuffer, // address of buffer that receives data
DWORD nNumberOfBytesToRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead, // address of number of bytes read
LPOVERLAPPED lpOverlapped // address of structure for data

I don't understand why i need a pointer to "number of bytes read" because i give this number on nNOBTR.

Why i have to give this address, and for what it is used for?
Is this adress the pointer to nNOBTR ?

Thank you very much.

Regard, Neitsa.
Posted on 2003-09-20 20:49:55 by Neitsa
Since the number of bytes you request to read can be different than the actual number read, for example if you encounter the end of the file before all the requested bytes are read, you have to declare a variable to hold the result of number of bytes actually read and pass the address to the API


invoke ReadFile,hFile,ADDR buffer,nBytesToRead,ADDR cbRead,NULL
Posted on 2003-09-20 20:53:49 by donkey