I have a binary data file that contains the following stucture and would like read it and then create an equivalent ascii file:

----begin of file------
novar novar
hdr1 hdr2 .... hdr(novar)
data1 data2 ...data(novar)
.
.
.
----end of file------

The first line contains the number of variables
The second line contains a variable name for each var
The third line (to the eof) contains data for each var

I would appreciate help in getting a C program to work that will create an ascii output file. I also attached a sample binary file to test with.

Thanks.