Chapter 3 135
Programming Examples
Saving Binary Trace Data in an ASCII File
/*set the analyzer to continuous mode for manual use */
viPrintf(viVSA, "INIT:CONT 1\n");
/*save trace data to an ASCII file*/
fTraceFile=fopen("C:\\Trace.txt","w");
fprintf(fTraceFile,"Trace.exe Output\nAgilent Technologies 2001\n\n");
fprintf(fTraceFile,"List of %d points of the averaged spectrum
trace:\n\n",lNumberPoints);
for (i=0;i<lNumberPoints;i++)
fprintf(fTraceFile,"\tAmplitude of point[%d] = %.2lf dBm\n",i+1,adTraceArray[i]);
fclose(fTraceFile);
/*print message to the standard output*/
printf("The %d trace points were saved to C:\\Trace.txt file\n\n",lNumberPoints);
/* Close session */
viClose (viVSA);
viClose (defaultRM);
}