Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
create a binary file based on hex data "54313032202020303030".
Posted
Comments
nv3 24-Apr-13 2:59am    
Where's the problem? Just open your hex editor, type the data in, and hit save.
Legor 24-Apr-13 3:00am    
Please provide more details.

1 solution

This smells of homework, so no code!
But it's really easy...

1 Create a buffer big enough to hold the output bytes: length of input / 2 should do it.
2 Convert a pair of hex digits to a unsigned byte, and add the byte to a buffer. Repeat until all pairs are used up.
3 Write the buffer to a file in binary mode.
 
Share this answer
 
Comments
CPallini 24-Apr-13 3:11am    
"Or simply have a look at your previous question's answer..." :-)
http://www.codeproject.com/Answers/582291/generatingplusaplusbinaryplusstringpluswithpluswei
SoMad 24-Apr-13 3:22am    
Sometimes I really wish I could upvote comments. :)

Soren Madsen
CPallini 24-Apr-13 3:31am    
:-)
nv3 24-Apr-13 3:42am    
Exactly!

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