Write to file: fprintf()
#include <stdio.h>
void main() {
FILE *fp;
fp = fopen("file.txt", "w"); // open the file
// write data to file
fprintf(fp, "Hello file for fprintf..\n");
fclose(fp); // close the file
}
Comments
#include <stdio.h>
void main() {
FILE *fp;
fp = fopen("file.txt", "w"); // open the file
// write data to file
fprintf(fp, "Hello file for fprintf..\n");
fclose(fp); // close the file
}