CURR STOY()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

Return a character string as a CURRENCY data type


SYNONYM

api_curr_stoy()


SYNOPSIS

#include "dbapi.h"
 
CURRENCY	CURR_STOY(string)
 
<input parameters>
char	string;		/* Address of a buffer containing a valid currency string	*/
 
<output parameters>
none


DESCRIPTION

The CURR_STOY() function will return the specified currency value in Recital CURRENCY storage format.

The character expression must be in the format "999999999999999.9999".


EXAMPLE

The following example converts the string "0202.99" to an currency value, then updates the memory variable specified in the first parameter as a Recital currency type.

#include "dbapi.h"
 
dbapi_curr_stoy()
{
    CURRENCY		curr;
    struct API_MEMVAR	*tmpbuf;
 
    curr = CURR_STOY( "0202.99" );
 
    if (_parinfo(1) == API_CTYPE) {
       MEMVAR_UPDATE(_parc(1), 'T', sizeof(CURRENCY), 0,
       tmpbuf->value.info_character,
       tmpbuf->value.info_number,
       tmpbuf->value.info_logical,
       tmpbuf->value.info_date ,
       tmpbuf->value.info_datetime,
       curr );
    }
}


SEE ALSO

_parys(), _retys(), ISCURRENCY(), CURR_YTOS()