let's suppose that we have this file : File1 contain : Ball, Earth, Planet, Soccer, Beach, Ball, Planet, by executing the code, our second file must contain : Ball, Earth, Planet, Soccer, Beach, the code consists of copying in the second file the contents of the first file without duplicates
int main() {
  char s1[32];
  char s2[32];
  FILE *f1;
  FILE *f2;
  FILE *ff;
  int temp = 1;
  /* ------------------------- */
  f1 = fopen("fic1.txt", "w+r");
  ff = fopen("fic1.txt", "w+r");
  f2 = fopen("fic2.txt", "w+r");
  /* ------------------------- */
  while (fgets(s1, 32, f1) != NULL) {
    fgets(s1, 32, f1);
    while (fgets(s2, 32, ff) != NULL) {
      if (f1 == ff) {
        ff++;
      } else {
        fgets(s2, 32, ff);
        if (strcmp(s1, s2) == 0) {
          temp = temp * 0;
        } else {
          temp = temp * 1;
        }
      }
    }
    if (temp == 0) {
      fprintf(f2, "%s", s1);
    }
  }
  fclose(f1);
  fclose(ff);
  fclose(f2);
}
I am a beginner, sorry if the code is plenty of mistakes Thank you
