Advertisement

11.28.2008 at 04:31PM PST, ID: 23943162 | Points: 500
[x]
Attachment Details

How to insert binary data into a file?

Tags:

c++ byte binary file io insert binary data

I want to read a file (any kind) and I want to insert 3 byte header in every 1400 byte.
1. read file size and print files size
2. insert 3 byte header into every 1400 byte
  something like:
|---3 byte header -- | --- 1400 byte of data --- | --- 3byte header --- |  --- 1400 byte of data --- |
3. write that on new binary file

The problem that I have is that I can read 1400 byte of data into memory but I cannot append the first 1400 byte data after the 3 byte header and I cannot do the second block and so on. How can I make loop to complete it and write in a new binary file? Please help me...
Top Expert: lherrou
Expert Since: 12/15/2003
Accepted Solutions: 1846
Computer Expertise: Guru
lherrou has been an Expert for 5 years, during which he has posted 8129 comments and answered 1846 questions. lherrou is just one of 173 experts in the Education Industry Zone.
 
 
20081119-EE-VQP-48 - Hierarchy / EE_QW_3_20080625