Binary File Parser

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2006
Posts: 1
Reputation: DJJazzyJim is an unknown quantity at this point 
Solved Threads: 0
DJJazzyJim's Avatar
DJJazzyJim DJJazzyJim is offline Offline
Newbie Poster

Binary File Parser

 
0
  #1
Dec 11th, 2006
Can anyone please point me in the direction of a tutorial on parsing a binary file and extracting data. I want to search for file headers in Hex and export the files.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Binary File Parser

 
0
  #2
Dec 11th, 2006
C or C++?

C++ Binary File I/O - Basically using ifstream/ofstream with special initalization parameters and using ::write and ::read to do file i/o instead of the stream operators (<< and >>).

C Binary File I/O - Using fopen(), but using fread() and fwrite() instead of fputs() and fgets() to read files.

Hope this helps
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,634
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1497
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Binary File Parser

 
0
  #3
Dec 11th, 2006
you have to know the format of the files before you can parse them. There normally is nothing in the file that says "I'm a header record". You have to know that bytes 0 to ??? is the header record, if one even exists in the file. Evey binary file is different, there is no standard way to write or read them other than how to use stream.write() and stream.read() functions. And those functions are completly ignorent of what it is reading or writing. That's all up to the programmer.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Binary File Parser

 
0
  #4
Dec 11th, 2006
Originally Posted by Ancient Dragon View Post
you have to know the format of the files before you can parse them. There normally is nothing in the file that says "I'm a header record". You have to know that bytes 0 to ??? is the header record, if one even exists in the file. Evey binary file is different, there is no standard way to write or read them other than how to use stream.write() and stream.read() functions. And those functions are completly ignorent of what it is reading or writing. That's all up to the programmer.
I forgot to mention that. If you want to parse any kind of binary file, you'll need documentation to know which order the variables have been stored in the file. For example, this guide documents parsing a WAV sound file.

Hope this helps
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1
Reputation: katisss is an unknown quantity at this point 
Solved Threads: 0
katisss katisss is offline Offline
Newbie Poster

Re: Binary File Parser

 
0
  #5
Mar 1st, 2008
Link is broken. Any working examples anyone?
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