Function _retclen() Foundation

Sets a character string with explicit length as a return value.

Syntax
BOOL _retclen(XppParamList pList, CHAR *cBuffer, ULONG ulSize);
Parameters
XppParamList pList
Pointer to the Xbase++ parameter list of the function whose return value is being set.
CHAR *cBuffer
Pointer to the string which is to be copied into the return container.
ULONG ulSize
Length of the string which is to be copied.
Return

If the string is copied successfully, the function returns TRUE. If the return value is FALSE, not enough memory is available for the string to be copied.

Description

_retclen() is used to return a string which may contain NULL characters as a character string to Xbase++. The string, including NULL characters, is copied into the return container up to the specified length. Calling this function does not exit the actual function, but merely sets the return value. After the call an access to other C-API functions except for _conRelease()is not allowed anymore and the function should return immediately.

To insure correct operation, a return value has always to be set. In Xbase++, NIL should be returned for procedures, which are functions without return values.

Examples
/* 
Reads data from a file and sets it as the return value of the 
function. 
*/ 
#include <xpppar.h> 
#include <stdio.h> 

CHAR  buffer[1024]; 
ULONG len; 

len = fread(<file>, buffer, 1024); 
retclen(<pList>, buffer, len); 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.