Agilent Technologies N5183A MXG Portable Generator User Manual


 
118 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Programming Examples
LAN Programming Interface Examples
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."
* +0,"No error"
* Don't bother decoding.
******************************************************************/
if (strncmp(result_str, "+0,", 3) == 0) {
/* Matched +0,"No error" */
break;
}