VISA Programming Examples How to Log Results
210 Agilent 8163A/B, 8164A/B & 8166A/B Mainframes, Fifth Edition
    /* display the values using %g, a float format specifier, you may 
also use %e or %f */
    for ( i = 0; i < noOfValues; i++)
    printf("\t%g\n",logResults[i]);
 
    /* loop, until a key is pressed */
    while(!scanf("%c",&c));
    /* close the session */
    viClose(vi); 
  }
void checkError(ViStatus session, ViStatus err_status )
  {
    ViStatus error;
    ViChar errMsg[256];
       error = viQueryf(session,"SYST:ERR?\n","%t",errMsg); 
       if (error == VI_ERROR_TMO) 
         {
         printf("System Error!\n") ;
         exit(1);
         }
       else 
         {
          /* only errors should be displayed */
          if(errMsg[0] != '+') 
          {
          printf("error:%ld --> %s\n", err_status,errMsg) ;
          if 
          ((!strncmp(errMsg,
          "- 303,\"Module slot empty or slot / channel invalid\"",
   strlen("- 303,\"Module slot empty or slot / channel invalid\""))) 
          ||
          (!strncmp(errMsg,
          "- 301,\"Module doesn't support this command 
(StatCmdUnknown)\"",
          strlen(
          "- 301,\"Module doesn't support this command 
(StatCmdUnknown)\""))))
           {  
             printf("No power meter in slot 1 so exiting\n\n");
         exit(1);
            }
          }
         }
  }
 
ViStatus InitVisa ( ViSession *iHandle)