COleStreamFile::CreateStream

Safely creates a new stream in the supplied storage object where a failure is a normal, expected condition.

BOOL CreateStream( 
   LPSTORAGE lpStorage, 
   LPCTSTR lpszStreamName, 
   DWORD nOpenFlags = modeReadWrite|shareExclusive|modeCreate, 
   CFileException* pError = NULL  
);

Parameters

  • lpStorage
    Points to the OLE storage object that contains the stream to be created. Cannot be NULL.

  • lpszStreamName
    Name of the stream to be created. Cannot be NULL.

  • nOpenFlags
    Access mode to use when opening the stream. Exclusive, read/write, and create modes are used by default. For a complete list of the available modes, see CFile::CFile.

  • pError
    Points to a CFileException object or NULL. Supply this parameter if you want to monitor possible exceptions generated by attempting to create the stream.

Return Value

Nonzero if the stream is created successfully; otherwise 0.

Remarks

A file exception will be thrown if the open fails and pError is not NULL.

For more information, see IStorage::CreateStream in the Windows SDK.

Requirements

Header: afxole.h

See Also

Reference

COleStreamFile Class

Hierarchy Chart

COleStreamFile::OpenStream

COleStreamFile::CreateMemoryStream

CFileException Class