Keysight E4428C ESG RF Programming Manual page 139

Signal generators
Table of Contents

Advertisement

return NULL;
} else {
return result;
}
#else
/***********************************************************************
* Simpler UNIX version, using file I/O.
* This demonstrates how to use file I/O on sockets, in UNIX.
***********************************************************************/
FILE * instFile;
instFile = fdopen(sock, "r+");
if (instFile == NULL)
{
fprintf(stderr, "Unable to create FILE * structure : %s\n",
strerror(errno));
exit(2);
}
return fgets(result, maxLength, instFile);
#endif
}
/***************************************************************************
*
> $Function: queryInstrument$
*
* $Description:
send a SCPI command to the instrument, return a response.$
*
* $Parameters:
$
*
(FILE *) . . . . . . . . . file pointer associated with TCP/IP socket.
*
(const char *command)
*
(char *result) . . . . . . where to put the result.
*
(size_t) maxLength . . . . maximum size of result array in bytes.
*
* $Return:
(long) . . . . . . . The number of bytes in result buffer.
*
* $Errors:
returns 0 if anything goes wrong. $
*
***************************************************************************/
long queryInstrument(SOCKET sock,
Keysight Signal Generators Programming Guide
. . SCPI command string.
const char *command, char *result, size_t maxLength)
recv() version works too.
Programming Examples
LAN Programming Interface Examples
131

Advertisement

Table of Contents
loading

Table of Contents