Condividi tramite


_RetCurrency( ) API Library Routine

Sets the library return value to a currency value.

void _RetCurrency(CCY money, int width)
CCY money;         /* CCY - LARGE_INTEGER. */
int width;         /* Number of columns to display. */

Remarks

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Example

The following example converts a numeric type value to currency type value.

Visual FoxPro Code

SET LIBRARY TO RETCURR
? xntom(100.1)

C Code

#include <pro_ext.h>
#include <math.h>

void FAR retcurr(ParamBlk FAR *parm)
{
   CCY money;

   money.HighPart = (long) (parm->p[0].val.ev_real*10000 / pow(2,32));
   
   money.LowPart = (unsigned long) ((parm->p[0].val.ev_real - (double) (money.HighPart * pow(2,32)/10000.0)) *10000);
   
   _RetCurrency(money,25);
}

FoxInfo myFoxInfo[] = {
   {"XNTOM", (FPFI) retcurr, 1, "N"}
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_RetChar( ) API Library Routine | _RetDateStr( ) API Library Routine | _RetDateTimeStr( ) API Library Routine | _RetFloat( ) API Library Routine | _RetInt( ) API Library Routine | _RetLogical( ) API Library Routine | _RetVal( ) API Library Routine