| | | Delphi中用于读写的文件类型 | | 2000-12-25·
·梅友松··yesky
| 上一页 1 2 3 下一页
异步操作:
// set up overlapped structure fields
gOverLapped.Offset = 0;
gOverLapped.OffsetHigh = 0;
gOverLapped.hEvent = NULL;
// attempt an asynchronous read operation
bResult = ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead,
&gOverlapped) ;
// if there was a problem, or the async. operation"s still pending ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we"re reached the end of the file
// during the call to ReadFile
// code to handle that
}
case ERROR_IO_PENDING:
{
// asynchronous i/o is still in progress
// do something else for a while
GoDoSomethingElse() ;
// check on the results of the asynchronous read
bResu = GetOverlappedResult(hFile, &gOverlapped,
&nBytesRead, FALSE) ;
// if there was a problem ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we"re reached the end of the file
file://during/ asynchronous operation
}
上一页 1 2 3 下一页 | | | 感谢
访问天极网,如果您觉得该文章涉及版权问题,请看这里!
|
|