[Solved] How to generate an xml file in C of 1GB


I solved it by creating three files.

One with the xml until the opening of the tag in which the data should reside.
The second with the generated junk data.
The third with the close tag of the bulk data en the rest of the xml.

Like so:

   // Open two files to be merged
   FILE *fp1 = fopen("person1.xml", "r");
   FILE *fp2 = fopen("randomdata.txt", "r");
   FILE *fp3 = fopen("person3.xml", "r");


   // Open file to store the result
   FILE *fp4 = fopen("personf.xml", "w");
   char c;

   if (fp1 == NULL || fp2 == NULL || fp3 == NULL || fp4 == NULL)
   {
         puts(" --- Could not open files");
         exit(0);
   }

   // Copy contents of first file1
   while ((c = fgetc(fp1)) != EOF)
      fputc(c, fp4);

   printf(" --- Done copying file 1\n");
   // Copy contents of first file2
   while ((c = fgetc(fp2)) != EOF)
      fputc(c, fp4);

   printf(" --- Done copying file 2\n");

   // Copy contents of first file3
   while ((c = fgetc(fp3)) != EOF)
      fputc(c, fp4);

   printf(" --- Done copying file 3\n");

   printf("Merged files\n");

   fclose(fp1);
   fclose(fp2);
   fclose(fp3);
   fclose(fp4);
   return 0;

solved How to generate an xml file in C of 1GB