Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have an array of type ushort with a length of 31. I wana store it's data as a data record in a special format called: "intel hex file format". How can I do this? Any ready-to-use sth? ;)
Posted
Comments
Toli Cuturicu 3-Nov-10 11:40am    
If you lock your question for editing, someone may get angry and delete it alltogether.
Anyway, it is rude to lock it, so please stop doing so.

Based on this article - http://en.wikipedia.org/wiki/Intel_HEX[^] - it seems fairly easy to do this directly. The format is straightforward, so you don't really need any 3rd party library to do this.
 
Share this answer
 
As Nish said, the Intel HEX format is pretty simple.

Here's the information I found in my notes from back when I had to write a parser for HEX files:

Intel HEX record format:
Leader - 1 char (":")
count - 2 chars (number of 2 character pairs in the data section)
address - 4 chars (16-bit address where the data should be placed in memory)
EOF Flag - 2 chars (00 = normal record, 01 = last record in the file)
data - 0-512(?) chars
checksum - 2 chars (sum of data bytes + checksum + 1 = 0 mod 256)

NOTE: The checksum uses the actual data bytes, not the characters that represent them.

I think HEX files may allow other address sizes, so you may have to change the address field accordingly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900