A version of this page is also available for
This function writes data into a stream.
BOOL CeStreamWrite( HANDLE hStream, LPBYTE lprgbBuffer, DWORD cbWrite, LPDWORD lpcbWritten );
[in] Handle to the stream object. The handle is obtained with the CeOpenStream (EDB) function.
[in] Pointer to the buffer that contains the data to write.
[in] Number of bytes to write from lprgbBuffer.
[out] On return, contains the actual number of bytes written. This value can be less than the value specified by cbWrite. This parameter can be set to NULL.
TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists possible values.
Indicates ones of the following:
The hStream parameter is set to NULL or equal to INVALID_HANDLE_VALUE.
The lprgbBuffer parameter is set to NULL.
The database from which the stream object was opened had its seek position changed. To prevent this, open a stream, perform the operations, and then close the stream before doing anything else in the parent database.
When using this function, the data is written at the current seek position. You can adjust the seek position of a stream with the CeStreamSeek (EDB) function. If the data is written to the end of the stream, the stream grows in size. To write to a stream, you must have specified the GENERIC_WRITE flag when opening the stream with CeOpenStream.
After the write has completed successfully, the current seek position is incremented by the number of bytes written. To save changes made with this function, call CeStreamSaveChanges. Data written to a stream overwrites data currently in the stream, but it does not truncate the stream on completion. To truncate the stream, use the CeStreamSetSize (EDB) function. If writing data to a stream for the first time or growing a stream, it is generally more efficient to use CeStreamSetSize to set the stream size, and then write to it.
|Windows Embedded CE||Windows CE 5.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|