home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / SICL / data1.cab / sicl32 / c / samples / misc / errhand.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-02  |  741 b   |  33 lines

  1. /* errhand.c
  2.    This example demonstrates how a SICL error handler
  3.    can be installed.
  4. */
  5.  
  6. #include <sicl.h>
  7. #include <stdio.h>
  8.  
  9. main ()
  10. {
  11.    INST dvm;
  12.    double res;
  13.  
  14.    #if defined(__BORLANDC__) && !defined(__WIN32__)
  15.       _InitEasyWin();   // required for Borland EasyWin programs
  16.    #endif
  17.  
  18.    ionerror (I_ERROR_EXIT);
  19.    dvm = iopen ("hpib7,16");
  20.    itimeout (dvm, 10000);
  21.    iprintf (dvm, "%s\n", "MEAS:VOLT:DC?");
  22.    iscanf (dvm, "%lf", &res);
  23.    printf ("Result is %f\n", res);
  24.    iclose (dvm);
  25.  
  26. /* For WIN16 programs, call _siclcleanup before exiting to release
  27.    resources allocated by SICL for this application.  This call
  28.    is a no-op for WIN32 programs. */
  29.    _siclcleanup();
  30.  
  31.    return 0;
  32. }
  33.