cwbOBJ_ReadResource
Use the cwbOBJ_ReadResource API with this product.
Purpose
Reads bytes from the current read location.
Syntax
unsigned int CWB_ENTRY cwbOBJ_ReadResource(
cwbOBJ_ObjHandle resourceHandle,
char *bBuffer,
unsigned long bytesToRead,
unsigned long *bytesRead,
cwbSV_ErrHandle errorHandle);
Parameters
- cwbOBJ_ObjHandle resourceHandle - input
- Handle of the AFP resource object to be read from.
- char *buffer - input
- Pointer to buffer to hold the bytes read from the resource.
- unsigned long bytesToRead - input
- Maximum number of bytes to read. The number read may be less than this.
- unsigned long *bytesRead - output
- Number of bytes actually read.
- cwbSV_ErrHandle errorHandle - output
- Optional, may be 0. Any returned messages will be written to this object. It is created with the cwbSV_CreateErrHandle() API. The messages may be retrieved through the cwbSV_GetErrText() API. If the parameter is set to zero, no messages will be retrievable.
Return Codes
The following list shows common return values.
- CWB_OK
- Successful completion.
- CWB_NOT_ENOUGH_MEMORY
- Insufficient memory.
- CWB_INVALID_HANDLE
- Handle is not valid spooled file handle.
- CWBOBJ_RC_HOST_ERROR
- Host error occurred. Text may be in errorHandle.
- CWBOBJ_RC_RSCNOTOPEN
- Resource file has not been opened yet.
- CWBOBJ_RC_ENDOFFILE
- The end of file was read.
Usage
The cwbOBJ_OpenResource() API must be called with this resource handle before this API is called OR the handle must be retrieved with a call to the cwbOBJ_OpenResourceForSplF() API. If the end of file is reached when reading, the return code will be CWBOBJ_RC_ENDOFFILE and bytesRead will contain the actual number of bytes read.