Schreiben Sie variabel in Datei c

FILE* f = fopen("number.txt", "w");  // open the file for writing
 if (f != NULL)                       // check for success
 {
     fprintf(f, "%d", 42);            // write the number 42 as a string
     fclose(f);                       // close the file
     f = NULL;                        // set file handle to null since f is no longer valid
 }
Shy Swan