Parser

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2008
Posts: 2
Reputation: Isha20 is an unknown quantity at this point 
Solved Threads: 0
Isha20 Isha20 is offline Offline
Newbie Poster

Parser

 
0
  #1
Aug 23rd, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Parser

 
0
  #2
Aug 23rd, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 2
Reputation: Isha20 is an unknown quantity at this point 
Solved Threads: 0
Isha20 Isha20 is offline Offline
Newbie Poster

Re: Parser

 
0
  #3
Aug 23rd, 2008
cant get u
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Parser

 
0
  #4
Aug 23rd, 2008
> 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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,669
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 123
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Parser

 
0
  #5
Aug 26th, 2008
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?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC