wcWriteLO( )

Syntax . . Returns . . Rules . . Program Example . . Related Topics . . A-Z Index . . Home


Write a large object (BLOB) such as an image, audio, or video file from the user defined buffer to the output buffer.

Example

returnCode = wcWriteLO(cntrlHandle, lobuf, len);

Syntax

int wcWriteLO(void *controlHandle, 
		void *buf,
		unsigned long len)
controlHandle The handle to the control structure.
lobuf The user-defined buffer holding a large object.
len The size of the buffer.

Returns

0 Success.
Error code Failure or exception. For a list of possible error codes, see Error Messages.

Rules

  • Before using wcWriteLO( ), you must first use wcDBOpen( ) to open the AppPages repository or your own user database connection and get the blob using wcGetLO().
  • Program Example

    The following code shows how wcWriteLO( ) is used in an application. The following portion of the application calls wcWriteLO( ) if the URL contains the variable MIvalObj.

    int loadLargeObject(void *wcp, char *pageId)
    {
    	char		*contentType;
    	char		*lobuf;
    	unsigned long	len;
    
    	wcGetVariable(wcp, "$MItypeObj", &contentType);
    	wcSetVariable(wcp, "$Content_Type", contentType);
    
    	wcLogPrintf(wcp, "Loading LO [%s] ...\n", pageId);
    
    	if ((ret = wcGetLO(wcp, pageId, (void *)&lobuf, &len)) != 0)  
    		return;
    
    	/* manipulate or modify the buffer .... */
    	
    	/* write the large object from lobuf to output */ 
    	if ((ret = wcWriteLO(wcp, pageId, lobuf, len)) != 0) 
     		return;
    	
    	if (NULL != lobuf)
    		free(lobuf);
    
    	return (ERR_OK);
    }
    

    Related Topics

    wcGetLO( )
    wcLoad( )


    Top of Page . . Syntax . . Returns . . Rules . . Program Example . . A-Z Index . . Home