#include #include int main(int argc, char **argv) { if(argc != 3) { fprintf(stderr, "do-not-close-stderr 'output string' 'output file'\n"); exit(EXIT_FAILURE); } FILE *fp = fopen(argv[2], "w"); if(!fp) { perror("fopen"); exit(EXIT_FAILURE); } fprintf(stderr, "Some kind of warning message.\n"); fprintf(fp, argv[1]); fprintf(fp, "\n"); fclose(fp); exit(EXIT_SUCCESS); }