Prev Up Next Index
Go backward to 9.4 Creating a Binary Archive
Go up to 9.4 Creating a Binary Archive
Go forward to 9.4.2 Converting to Binary

9.4.1 Simple ASCII to Binary Conversion

In this example, you will use newform to convert the ASCII data file latlon.dat into the binary file latlon.bin. The input and output data formats are described in latlon.fmt.

Here is the latlon.fmt file:

/ This is the format description file for data files latlon.bin 
/ and latlon.dat. Each record in both files contains two fields, 
/ latitude and longitude.

binary_data "binary format"
latitude 1 8 double 6
longitude 9 16 double 6

ASCII_data "ASCII format"
latitude 1 10 double 6
longitude 12 22 double 6

The binary and ASCII variables both have the same names. The binary variable latitude occupies positions 1 to 8 and longitude occupies positions 9-16. The corresponding ASCII variables occupy positions 1-10 and 12-22. Both the binary and ASCII variables are stored as doubles and have a precision of 6.


Tom Sgouros and James Gallagher, 2006-02-12

Prev Up Next