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

  1. #include <stdio.h>
  2. #include "pxengine.h"
  3.  
  4. #define TABLENAME        "table"
  5.  
  6. int main(void)
  7. {
  8.     TABLEHANDLE tblHandle;
  9.     RECORDHANDLE recHandle;
  10.     FIELDHANDLE fldHandle;
  11.     long lvalue;
  12.     int pxErr;
  13.  
  14.     PXInit();
  15.     PXTblOpen(TABLENAME, &tblHandle, 0, 0);
  16.     PXRecBufOpen(tblHandle, &recHandle);
  17.     PXFldHandle(tblHandle,"Numeric Field",&fldHandle);
  18.     PXRecGet(tblHandle, recHandle);
  19.  
  20.     /* Get a long value from a record */
  21.     if ((pxErr = PXGetLong(recHandle, fldHandle, &lvalue))
  22.     != PXSUCCESS)
  23.         printf("%s\n", PXErrMsg(pxErr));
  24.     else
  25.         printf("Field number %d contents: %ld\n", fldHandle, lvalue);
  26.  
  27.     PXRecBufClose(recHandle);
  28.     PXTblClose(tblHandle);
  29.     PXExit();
  30.     return(pxErr);
  31. }
  32.