CeStreamWrite (EDB)
A version of this page is also available for
4/8/2010
This function writes data into a stream.
Syntax
BOOL CeStreamWrite(
HANDLE hStream,
LPBYTE lprgbBuffer,
DWORD cbWrite,
LPDWORD lpcbWritten
);
Parameters
- hStream
[in] Handle to the stream object. The handle is obtained with the CeOpenStream (EDB) function.
- lprgbBuffer
[in] Pointer to the buffer that contains the data to write.
- cbWrite
[in] Number of bytes to write from lprgbBuffer.
- lpcbWritten
[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.
Return Value
TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists possible values.
Return Value | Description |
---|---|
ERROR_ACCESS_DENIED |
Indicates ones of the following:
|
ERROR_INVALID_HANDLE |
The hStream parameter is set to NULL or equal to INVALID_HANDLE_VALUE. |
ERROR_INVALID_PARAMETER |
The lprgbBuffer parameter is set to NULL. |
ERROR_NO_MORE_ITEMS |
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. |
Remarks
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.
Requirements
Header | windbase.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
EDB Functions
CeOpenStream (EDB)
CeStreamSaveChanges (EDB)
CeStreamSeek (EDB)
CeStreamSaveChanges (EDB)
CeStreamSetSize (EDB)