home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a006 / 2.ddi / CEXAM.ZIP / GETSHORT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-11  |  719 b   |  31 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.     short svalue;
  12.     int pxErr;
  13.  
  14.     PXInit();
  15.     PXTblOpen(TABLENAME, &tblHandle, 0, 0);
  16.     PXRecBufOpen(tblHandle, &recHandle);
  17.     PXRecGet(tblHandle, recHandle);
  18.     PXFldHandle(tblHandle,"Short Field",&fldHandle);
  19.  
  20.     if ((pxErr = PXGetShort(recHandle, fldHandle, &svalue))
  21.     != PXSUCCESS)
  22.         printf("%s\n", PXErrMsg(pxErr));
  23.     else
  24.         printf("Field number %d contents: %d\n", fldHandle, svalue);
  25.  
  26.     PXRecBufClose(recHandle);
  27.     PXTblClose(tblHandle);
  28.     PXExit();
  29.     return(pxErr);
  30. }
  31.