Technical data

1076 Agilent Infiniium 90000 Series Oscilloscopes Programmer's Reference
36 Reference
Example Program for Reading Binary Data
The following is a programming example of reading a Binary Data (.bin)
file and converting it to a CSV (.csv) file without a file header.
/* bintoascii.c */
/* Reads the binary file format.
This program demonstrates how to import the Infiniium
oscilloscope binary file format and how to export it to an
ascii comma seperated file format.
*/
#pragma pack(4)
#include <stdio.h> /* location of: printf() */
#include <stdlib.h> /* location of: atof(), atoi() */
#include <string.h> /* location of: strlen() */
#include "sicl.h"
/* Defines */
#define MAX_LENGTH 10000000
#define INTERFACE "lan[130.29.70.247]:inst0" /* Change the IP address
* to the one found in
* the Remote Setup
* dialog box.
*/
#define TRUE 1
#define FALSE 0
#define IO_TIMEOUT 20000
/* Type definitions */
typedef unsigned _int64 UINT64; /* This defines a 64-bit unsigned
* integer for Microsoft platforms.
*/
/* Structure and Union definitions */
union DATATYPE
{
char buffer[MAX_LENGTH]; /* Buffer for reading word format data */
char byte[MAX_LENGTH];
unsigned short word[MAX_LENGTH/2];
UINT64 longlong[MAX_LENGTH/4];
};
typedef struct
{
char Cookie[2];
char Version[2];
int FileSize;
int NumberOfWaveforms;
} FileHeader;
const char COOKIE[2] = {'A', 'G'};
const char VERSION[2] = {'1', '0'};