Keysight E4428C ESG RF Programming Manual page 140

Signal generators
Table of Contents

Advertisement

Programming Examples
LAN Programming Interface Examples
{
long ch;
char tmp_buf[8];
long resultBytes = 0;
int command_err;
int count;
/*********************************************************
* Send command to signal generator
*********************************************************/
command_err = commandInstrument(sock, command);
if (command_err) return COMMAND_ERROR;
/*********************************************************
* Read response from signal generator
********************************************************/
count = recv(sock, tmp_buf, 1, 0); /* read 1 char */
ch = tmp_buf[0];
if ((count < 1) || (ch == EOF)
{
*result = '\0';
return 0;
}
/* use a do-while so we can break out */
do
{
if (ch == '#')
{
/* binary data encountered - figure out what it is */
long numDigits;
long numBytes = 0;
/* char length[10]; */
count = recv(sock, tmp_buf, 1, 0); /* read 1 char */
ch = tmp_buf[0];
if ((count < 1) || (ch == EOF)) break; /* End of file */
if (ch < '0' || ch > '9') break;
numDigits = ch - '0';
132
|| (ch == '\n'))
/* null terminate result for ascii */
/* unexpected char */
Keysight Signal Generators Programming Guide

Advertisement

Table of Contents
loading

Table of Contents