#include <visa.h>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
ViStatus errorStatus = 0;
ViSession viRm = 0, vi = 0;
char buf [0xffff] = {0};
/* Open session to GPIB device at address 10 */
errorStatus = viOpenDefaultRM(&viRm);
errorStatus = viOpen(viRm, "GPIB0::10::INSTR",
VI_NULL, VI_NULL, &vi);
/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?\n");
/* Read results */
viScanf (vi, "%t", &buf);
printf ("IDN? response: %s\n", buf);
/* Close session */
viClose (vi);
viClose (viRm);
return 0;
}
Example output of the short C++ / Unmanaged program above:
IDN? response: Keysight Technologies,81150A /
81160A,DE1234567,0.22.104.12-0