get_xarg_cstr

Get a subroutine argument as a null-terminated C string

WSupported on Windows
USupported on Unix

 

 

int get_xarg_cstr(DESCRIP **argblock, int arg, char *buffer, 
                  int length, int strip_flag)

Arguments

argblock

The argument block pointer passed by the Synergy DBL subroutine to the C function.

arg

The number of the argument to reference.

buffer

The pointer to the buffer in which to load the string.

length

The length of the buffer in which to load the string.

strip_flag

A flag that indicates if trailing blanks are to be stripped from the string.

Discussion

The get_xarg_cstr function gets a subroutine argument as a null-terminated C string.

Strip_flag is true if trailing blanks are to be stripped. The return value is the length of the resulting string. The length can be zero.

If the argument wasn’t passed, the returned length is zero. If the size of the resulting string is greater than or equal to length, only length characters are transferred and the string isn’t null-terminated. If buffer is null, no data is transferred, but the string’s size is returned.

This routine is intended for situations in which a Synergy DBL alpha field must be accessed as a C, null-terminated string. In general, we do not recommend that you manipulate Synergy DBL fields as null-terminated strings, which requires the caller to load and transform a copy of a DBL field into a local buffer, manipulate the resulting null-terminated string in a way that is not consistent with DBL data, and then reload the string back into the DBL field. It is much more efficient to manipulate the data directly in its native DBL form.

On OpenVMS, this functionality of get_xarg_cstr is available as dscr_to_cstr. See the xcallv.h file for details.