home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a006 / 2.ddi / CEXAM.ZIP / GETDATE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-11  |  839 b   |  36 lines

  1. #include <stdio.h>
  2. #include "pxengine.h"
  3.  
  4. #define TABLENAME        "table"
  5.  
  6. int main(void)
  7. {
  8.     RECORDHANDLE recHandle;
  9.     FIELDHANDLE fldHandle;
  10.     TABLEHANDLE tblHandle;
  11.     long date;
  12.     int month, day, year;
  13.     int pxErr;
  14.  
  15.     PXInit();
  16.     PXTblOpen(TABLENAME, &tblHandle, 0, 0);
  17.     PXRecBufOpen(tblHandle, &recHandle);
  18.     PXFldHandle(tblHandle,"Date Field",&fldHandle);
  19.     PXRecGet(tblHandle, recHandle);
  20.  
  21.     /* Get a date field out of a record buffer*/
  22.     if ((pxErr = PXGetDate(recHandle, fldHandle, &date))
  23.     != PXSUCCESS)
  24.         printf("%s\n", PXErrMsg(pxErr));
  25.     else 
  26.     {
  27.         PXDateDecode(date, &month, &day, &year);
  28.         printf("Date: %d/%d/%d\n", month, day, year);
  29.     }
  30.  
  31.     PXRecBufClose(recHandle);
  32.     PXTblClose(tblHandle);
  33.     PXExit();
  34.     return(pxErr);
  35. }
  36.