This naive code (warning: very bad error-handling)
#include <stdio.h>
int main()
{
unsigned char a[1024];
FILE * fp = fopen(filepath, "wb");
if ( !fp ) return -1;
if (fseek(fp, 1000000000L,SEEK_SET) ) return -2;
if (fwrite(a, 1, sizeof(a), fp) != sizeof(a) ) return -3;
fclose(fp);
}
takes circa 25" on my system. If such a long time is not acceptable then save the received blocks on temporary files, eventually recomposing the complete big file in a background thread.
:)