#include /* C example */ #include int main(int argc, char **argv) { FILE *out1; FILE *out2; /* Open two output files. Clobber them if they already exist; create them if they don't. */ out1 = fopen("outfile1", "w"); if (out1 == NULL) { fprintf(stderr, "can't open outfile1.\n"); return EXIT_FAILURE; } out2 = fopen("outfile2", "w"); if (out2 == NULL) { fprintf(stderr, "can't open outfile2.\n"); return EXIT_FAILURE; } fprintf(out1, "hello\n"); /* Output 6 char's. Do not output '\0'. */ fprintf(out2, "goodbye\n"); fclose(out1); fclose(out2); return EXIT_SUCCESS; }