Agilent Technologies E4406A VSA Satellite Radio User Manual


 
160 Chapter 3
Programming Examples
Using C Programming Over Socket LAN
*result = (char)ch;
if (recv_line(sock, result+1, maxLength-1) == NULL) return 0;
/* REMOVE trailing newline, if present. And terminate string. */
resultBytes = strlen(result);
if (result[resultBytes-1] == \n) resultBytes -= 1;
result[resultBytes] = \0;
}
} while (0);
return resultBytes;
}
/*************************************************************************
*
> $Function: showErrors$
*
* $Description: Query the SCPI error queue, until empty. Print results. $
*
* $Return: (void)
*
*************************************************************************/
void showErrors(SOCKET sock)
{
const char * command = "SYST:ERR?\n";
char result_str[256];
do {
queryInstrument(sock, command, result_str, sizeof(result_str)-1);
/******************************************************************
* Typical result_str:
* -221,"Settings conflict; Frequency span reduced."