Parc()

From Lianjapedia
Jump to: navigation, search

PURPOSE

Pass a pointer to a character string

SYNONYM

api_par_c()

SYNOPSIS

#include "lianja_api.h"
 
char	* _parc(order [,index])
 
<input parameters>
int	order;	/* Placement in actual parameter list 	*/
int	index;	/* Array element index				*/
 
<output parameters>
none

DESCRIPTION

The _parc() function is used for getting a character parameter. The order specifies the actual placement in the parameter list. If the parameter passed is an array, then the optional index value is used to specify the required element number.

NOTE: There is only one pointer on the stack for _parc(). The 'C' strcpy() function must be used to copy the result to a variable, you cannot simply pass the pointer.

EXAMPLE

The following example returns the character string passed in the first parameter.

Example Lianja script:

m_string="LIANJA"
m_string=string( m_string )
return

Example 'C' function:

#include "lianja_api.h"
 
lianjaapi_string()
{
    char string[9];
 
    if ( _parinfo(1) == API_CTYPE ) {
       strcpy( string, _parc(1));
    } else {
       strcpy( string, "" );
    }
 
    _retc( string );
}

SEE ALSO

_parclen(), _parcsiz(), _parinfo(), _retc(), _retclen(), ISCHAR(), CHAR_ALLTRIM(), CHAR_LOWER(), CHAR_LPAD(), CHAR_LTRIM(), CHAR_RPAD(), CHAR_RTRIM(), CHAR_STR(), CHAR_UPPER(), DATE_STOD()