Agilent Technologies N5183A MXG User Manual

Page 256

Advertising
background image

246

Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide

Creating and Downloading Waveform Files
Programming Examples

//

// IMPORTANT:

// Configure the following three lines correctly before compiling and running

char* instOpenString ="TCPIP0::xxx.xxx.xxx.xxx::INSTR"; // your instrument's IP address

const char* localSrcFile = "\\Files\\IQ_DataC";

const char* instDestFile = "/USER/WAVEFORM/IQ_DataC";

const int BUFFER_SIZE = 100*1024;// Size of the copy buffer

int main(int argc, char* argv[])

{

ViSession defaultRM, vi;

ViStatus status = 0;

status = viOpenDefaultRM(&defaultRM);// Open the default resource manager

// TO DO: Error handling here

status = viOpen(defaultRM, instOpenString, VI_NULL, VI_NULL, &vi);

if (status)// If any errors then display the error and exit the program

{

fprintf(stderr, "viOpen failed (%s)\n", instOpenString);

return -1;

}

FILE* file = fopen(localSrcFile, "rb");// Open local source file for binary reading

if (!file) // If any errors display the error and exit the program

{

fprintf(stderr, "Could not open file: %s\n", localSrcFile);

return 0;

}

if( fseek( file, 0, SEEK_END ) < 0 )

{

fprintf(stderr,"Cannot lseek to the end of file.\n" );

return 0;

}

Advertising
This manual is related to the following products: