I have to design a parser to convert Binary(HEX) File into number. I have to refer a format file for the same which is as follows:

(Sr No;field_name;position;length;datatype;flag;)
1;TimeStamp;0;4;HEXA;0;
2;TimeOffset;4;4;HEXA;1;
3;Data_Vol;8;4;HEXA;1;

................so on.........it has 60 fields, which represent 1 record.

Binary file:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Can you please help me coding this C program?

Recommended Answers

All 4 Replies

Sure, show us how you would begin with reading your format file to
- read each line
- tokenise the line at each ;
- print the value of each token

cant get u

> 1;TimeStamp;0;4;HEXA;0;
True or false.
This information is in a text file you're supposed to read first, before processing the binary file?

it looks to me like you're supposed to create a header file according to a specific format (partially described above) based on attributes of the binary or hex file in question.

is that right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.