Reduce file size in android native

  android-native-library, c++, file-io

I just want to write a file of size 1 MB from temp file and its size is more than 20 MB. Use this way to reduce the current file size:

int X = 1024 * 1024 - 10;
FILE *fp = fopen(file_path, "wb");
fseek(fp, X , SEEK_SET);
fputc('{$content}', fp);

This works as file size is reduced to 1 mb but data in the file is lost. File is blank any idea what I am missing or Any other way to just get 1 MB of data from the file if temp file size is 10 MB. Thanks.

Source: Windows Questions C++