I have a binary file already open in memory,
FILE* fptr = fopen(filename, "wb");
I already wrote some data to this file:
fwrite(fptr, ...);
After writing all my data, how do I prepend data at the beginning of this file?
I have a binary file already open in memory,
FILE* fptr = fopen(filename, "wb");
I already wrote some data to this file:
fwrite(fptr, ...);
After writing all my data, how do I prepend data at the beginning of this file?
I belive that there is no cross-plattform way of doing so...
My solution would be the following:
1.
) read data at the endThis will lead to the result you wanted. If you need only one writing operation, you should first manage all your data in memory before writing it to a file...