CAtlFile::Read

 

Call this method to read data from a file starting at the position indicated by the file pointer.

Syntax

      HRESULT Read(
   LPVOID pBuffer,
   DWORD nBufSize
) throw( );
HRESULT Read(
   LPVOID pBuffer,
   DWORD nBufSize,
   DWORD& nBytesRead 
) throw( );
HRESULT Read(
   LPVOID pBuffer,
   DWORD nBufSize,
   LPOVERLAPPED pOverlapped
) throw( );
HRESULT Read(
   LPVOID pBuffer,
   DWORD nBufSize,
   LPOVERLAPPED pOverlapped,
   LPOVERLAPPED_COMPLETION_ROUTINE pfnCompletionRoutine
) throw( );

Parameters

  • pBuffer
    Pointer to the buffer that will receive the data read from the file.

  • nBufSize
    The buffer size in bytes.

  • nBytesRead
    The number of bytes read.

  • pOverlapped
    The overlapped structure. See lpOverlapped in ReadFile in the Windows SDK.

  • pfnCompletionRoutine
    The completion routine. See lpCompletionRoutine in ReadFileEx in the Windows SDK.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

The first three forms call ReadFile, the last ReadFileEx to read data from the file. Use CAtlFile::Seek to move the file pointer.

Requirements

Header: atlfile.h

See Also

CAtlFile Class
CAtlFile::Write