_RetLogical( ) API Library Routine Example

The following example is a coin flip. It returns .T. or .F. based on the library function RAND( ).

Visual FoxPro Code

SET LIBRARY TO RETLOGIC
? RETLOGICAL()  && returns .T. or .F. pseudo-randomly

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
   _RetLogical(rand() % 2);
}

FoxInfo myFoxInfo[] = {
   {"RETLOGICAL", (FPFI) Example, 0, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};