Bool writefileex (
Handle hfile,
Lpcvoid lpbuffer,
DWORD nnumberofbytestowrite,
Lpoverlapped,
Lpoverlapped_completion_routine lpcompletionroutine
);
Description: writes data to a file. This function can only be used for asynchronous I/O operations, that is, overlapped I/O. Note: writefile () can be used for synchronous and asynchronous I/O operations.
Hfile: file handle, which can be created using the createfile () function. This function can be called only when the file handle created using the file_flag_overlapped flag is used.
Lpbuffer: pointer to data
Nnumberofbytestowrite: number of bytes to be written.
Lpoverlapped: pointer to the overlapped variable.
Lpcompletionroutine: function pointer. This can be called asynchronous procedure CALS (APCs ). Function prototype:
Void callback fileiocompletionroutine (
DWORD dwerrorcode,
DWORD dwnumberofbytestransfered,
Lpoverlapped
);
Note the following:
1. Only "ex" readfile () and writefile () can be used in asynchronous process calls ().
2. In readfileex () and writefileex (). The hevent field in the specified overlapped does not need to be used to place an event handle. Free to use. Average
Useful pointers can be placed here.
Bool readfileex (
Handle hfile,
Lpvoid lpbuffer,
DWORD nnumberofbytestoread,
Lpoverlapped,
Lpoverlapped_completion_routine lpcompletionroutine
);
Description: reads data. The parameters are the same as those above.