What’s a short way to prepend 3 bytes to the beginning of a binary file in C?
listed in answer
ANSWER:
This isn’t so much about C as about filesystems; there aren’t many common filesystem APIs that provide shortcuts for prepending data, so in general the straightforward way is the only one.
You may be able to use some form of memory-mapped I/O appropriate to your platform, but this trades off one set of problems for another (such as, can you map the entire file into your address space or are you forced to break it up into chunks?).
by geekosaur from http://stackoverflow.com/questions/10307063

New Comments