共用方式為


_RetLogical( ) API Library Routine

Sets the library return value to a logical value.

void _RetLogical(int flag)
int flag;                     /* Flag. */

Remarks

_RetLogical( ) considers zero to be False, and any non-zero value to be True.

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 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
};

See Also

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