Keysight E4428C ESG RF Programming Manual page 281

Signal generators
Table of Contents

Advertisement

if( fseek( file, 0, SEEK_END ) < 0 )
{
fprintf(stderr,"Cannot seek to the end of file.\n" );
return 0;
}
long lenToSend = ftell(file);
printf("File size = %d\n", lenToSend);
if (fseek(file, 0, SEEK_SET) < 0)
{
fprintf(stderr,"Cannot seek to the start of file.\n");
return 0;
}
char* buf = new char[BUFFER_SIZE];
if (buf && lenToSend)
{
// Prepare and send the SCPI command header
char s[20];
sprintf(s, "%d", lenToSend);
int lenLen = strlen(s);
char s2[256];
sprintf(s2, "mmem:data \"%s\", #%d%d", instDestFile, lenLen, lenToSend);
iwrite(id, s2, strlen(s2), 0, 0);
// Send file in BUFFER_SIZE chunks
long numRead;
do
{
numRead = fread(buf, sizeof(char), BUFFER_SIZE, file);
iwrite(id, buf, numRead, 0, 0);
} while (numRead == BUFFER_SIZE);
// Send the terminating newline and EOM
iwrite(id, "\n", 1, 1, 0);
delete [] buf;
}
else
{
Keysight Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
273

Advertisement

Table of Contents
loading

Table of Contents