Agilent Technologies E8663B Portable Generator User Manual


 
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide 123
Programming Examples
LAN Programming Interface Examples
/* read a line from <stdin> */
while ( gets(charBuf) != NULL )
{
if ( !strlen(charBuf) )
continue ;
if ( *charBuf == '#' || *charBuf == '!' )
continue ;
strcat(charBuf, "\n");
if (!quiet)
{
if (number)
{
char num[10];
sprintf(num,"%d: ",number);
fwrite(num, strlen(num), 1, stdout);
}
fwrite(charBuf, strlen(charBuf), 1, stdout) ;
fflush(stdout);
}
if ( isQuery(charBuf) )
{
long bufBytes;
/* Put the query response into the same buffer as the*/
/* command string appended after the null terminator.*/
bufBytes = queryInstrument(instSock, charBuf,
charBuf + strlen(charBuf) + 1,
INPUT_BUF_SIZE -strlen(charBuf) );
if (!quiet)
{
fwrite(" ", 2, 1, stdout) ;
fwrite(charBuf + strlen(charBuf)+1, bufBytes, 1, stdout);
fwrite("\n", 1, 1, stdout) ;
fflush(stdout);
}
}
else