Im trying to copy contents of one image file to another. But somehow my code creates an empty image. Here is the code
void main() {
  FILE* i = fopen("index.jpg", "r");
  int size = 0;
  int index = 0;
  char buff[1024];
  FILE* j = fopen("abc.jpg", "w+");
  while (!feof(i)) {
    fread(buff, 1, 1024, i);
    fwrite(buff, 1, 1024, j);
    index += 1024;
    fseek(i, index, SEEK_SET);
    seek(j, index, SEEK_SET);
  }
  fclose(i);
  fclose(j);
  FILE* picture = fopen("abc.jpg", "r");
  fseek(picture, 0, SEEK_END);
  size = ftell(picture);
  fseek(picture, 0, SEEK_SET);
  printf("Total Picture size: %i\n", size);
}
 
     
     
    