Share via


CAtlFile::Write

Call this method to write data to the file starting at the position indicated by the file pointer.

HRESULT Write( 
   LPCVOID pBuffer, 
   DWORD nBufSize, 
   LPOVERLAPPED pOverlapped, 
   LPOVERLAPPED_COMPLETION_ROUTINE pfnCompletionRoutine  
) throw( ); 
HRESULT Write( 
   LPCVOID pBuffer, 
   DWORD nBufSize, 
   DWORD* pnBytesWritten = NULL  
) throw( ); 
HRESULT Write( 
   LPCVOID pBuffer, 
   DWORD nBufSize, 
   LPOVERLAPPED pOverlapped  
) throw( );

Parameters

  • pBuffer
    The buffer containing the data to be written to the file.

  • nBufSize
    The number of bytes to be transferred from the buffer.

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

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

  • pnBytesWritten
    The bytes written.

Return Value

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

Remarks

The first three forms call WriteFile, the last calls WriteFileEx to write data to the file. Use CAtlFile::Seek to move the file pointer.

Requirements

Header: atlfile.h

See Also

Reference

CAtlFile Class

CAtlFile::Read