I want to know what would be an efficient way of do it. I haven't written any code yet, i just have a couple of ideas. Here they go both (just an idea about how code would look like):
To write entire buffer in one step like:
fwrite ( buffer , 1 , totalBufferSize , filePointer );
To divide buffer into smaller parts, of 1024 bytes each.
This, requires to copy 1024 bytes from original buffer to a temporal one, and then
copy it to the image like:
Here i'm not counting on not all packages will have a regular size of 1024 bytes, the last
int copyStartPosition; /* Position of original buffer where copy begins */
for ( i = 0 ; i < 1024 ; i++ )
tmpBuffer[i] = originalBuffer[i+copyStartPosition];
fwrite ( tmpBuffer , 1 , 1024 , filePointer );
one could not have it.
Am i in the right way to solve this problem?