_RetDateStr( ), API-Bibliotheksroutine

Legt den Bibliotheksrückgabewert auf ein Datum fest.

void _RetDateStr(char FAR *string)
char FAR *string;            /* Date string. */

Hinweise

Geben Sie die Datumszeichenfolge im Format MM/TT/Jahr an, wobei das Jahr entweder aus zwei oder vier Stellen bestehen kann.

Weitere Informationen zum Erstellen einer API-Bibliothek und ihrer Integration in Visual FoxPro finden Sie unter Zugreifen auf die Visual FoxPro-API.

Beispiel

Im folgenden Beispiel wird eine Zeichenfolge in den Datentyp Datum umgewandelt und an Visual FoxPro zurückgegeben.

Visual FoxPro-Code

SET LIBRARY TO RETDATES
? DATES("02/16/95")  && returns date {02/16/95}

C-Code

#include <pro_ext.h>

void FAR dates(ParamBlk FAR *parm)
{
   MHANDLE mh;
   char FAR *instring;

   if ((mh = _AllocHand(parm->p[0].val.ev_length + 1)) == 0) 
   {
      _Error(182); // "Insufficient memory"
   }
   _HLock(parm->p[0].val.ev_handle);
   instring = _HandToPtr(parm->p[0].val.ev_handle);
   instring[parm->p[0].val.ev_length] = '\0';
   _RetDateStr(instring);
   _HUnLock(parm->p[0].val.ev_handle);
}

FoxInfo myFoxInfo[] = {
   {"DATES", (FPFI) dates, 1, "C"}
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

Siehe auch

_RetChar( ), API-Bibliotheksroutine | _RetCurrency( ), API-Bibliotheksroutine | _RetDateTimeStr( ), API-Bibliotheksroutine | _RetFloat( ), API-Bibliotheksroutine | _RetInt( ), API-Bibliotheksroutine | _RetLogical( ), API-Bibliotheksroutine | _RetVal( ), API-Bibliotheksroutine