Write to binary file --help

I'm currently working on a code wherein I will have a text file format and convert particular field/data to hex and output should be binary format...
I was able to convert text data to hex format but the problem is how to write the data to bin file format

e.g

pos 1-2 = 0xFAFA
pos 3-6 = B33
pos 7-10 = B29
next = 1 (ansi c descripption is long - length is 4)
next = 0200 (char based length of 4)

output should be like below:

when viewed using ultraedit - hex viewer:
FAFA00000B3300000B290000000130323030

when view using notepad:
รบรบ 3 ) 0200
Open the File using the open function with the right open mode
then use the function to write to the bin file, its all here:
http://www.cplusplus.com/reference/iostream/fstream/


Jeff
Last edited on
Topic archived. No new replies allowed.