8163A/B, 8164A/B & 8166A/B Mainframes Programming Guide
251
VISA Programming Examples
6
{
errStatus = viQueryf(vi,"SENS%1d:CHAN%1d:FUNC:STATE?\
n","%t",slot,chan,replyBuf);
/* if an error occurs break the loop */
if (errStatus < VI_SUCCESS)
{
checkError(vi,errStatus);
break;
}
/* find the substring "COMPLETE" in the reply of the
instrument */
replySubStr = replyBuf;
while(*replySubStr)
{
if(!strncmp(replySubStr,"COMPLETE",strlen("COMPLETE")))
break;
reply+;
}
}while (!*replySubStr); /*substring "COMPLETE" not found
*/
/*continue polling */
/* The instrument returns the logging result in the
following format: #xyyyffff...; the first digits after the
hash denotes the number of ascii digits following (y) ; y
specifies the number of binary data following; "ffff"
represent the 32Bit floats as log result. */
/* get the result */
errStatus = viPrintf(vi,"SENS%1d:CHAN%1d:FUNC:RES?\
n",slot,chan);
/* only query an error, if there is one, else the query
will be interrupted ! */
if(errStatus < VI_SUCCESS)checkError(vi,errStatus);
/* read the binary data */
errStatus = viRead(vi, logBuffer, MAX_LOG_VALUES *
sizeof(ViReal32) + HEADER_SIZE, &retCnt);
checkError(vi,errStatus);
if(logBuffer[0] != '#')
{
printf("invalid format returned from logging\n");
exit(1);
}
else