Jump to content
Registration disabled at the moment Read more... ×
JDRenk

Adding a header to a bin file

Recommended Posts

How do I save binary data to a file with a fixed header?  Like using APPEND for text.

Share this post


Link to post

Are you in control of both the data and the header? If yes, open the file for writing in your preferred method (AssignFile, TFiles, TFileStream) and write the header, then the data.

 

If you get a file from an external source and you need to add a header, the easiest solution is a stream. Write your header and then copy the data from said file, loaded in a TFileStream.

 

 If you receive one header files and need to append data, all 3 methods (AssignFile, TFile, TFileStream) can append binary data to it.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×