FILE *f = fopen("file.txt", "w");if (f == NULL){ printf("Error opening file!n"); exit(1);}const char *text = "Write this to the file";fprintf(f, "Some text: %sn", text);int i = 1;float py = 3.1415927;fprintf(f, "Integer: %d, float: %fn", i, py);char c = 'A';fprintf(f, "A character: %cn", c);fclose(f);


