1 #include <assert.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 static char* message = "hello, file!"; 6 main()7int main() { 8 FILE* file = fopen("/tmp/output.txt", "w"); 9 assert(file != NULL); 10 11 int nwritten = fprintf(file, "%s", message); 12 assert(nwritten == strlen(message)); 13 int r = fclose(file); 14 assert(r == 0); 15 } 16