📅  最后修改于: 2022-03-11 14:59:13.550000             🧑  作者: Mango
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
}