Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide 135
Programming Examples
LAN Programming Interface Examples
/*********************************************************
* Read response from signal generator
********************************************************/
count = recv(sock, tmp_buf, 1, 0); /* read 1 char */
ch = tmp_buf[0];
if ((count < 1) || (ch == EOF) || (ch == '\n'))
{
*result = '\0'; /* null terminate result for ascii */
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; /* unexpected char */
numDigits = ch - '0';
if (numDigits)
{
/* read numDigits bytes into result string. */
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...