#define _GNU_SOURCE #include #include int main( int argc, char *argv[] ) { const char *filename = "junkfile.txt"; FILE *fp; if(( fp = fopen( filename, "w+" )) == NULL ) { printf( "Can't open result file.\n" ); return 1; } fcloseall(); /* fclose( fp ); fclose( stdout ); fclose( stderr ); fclose( stdin ); */ fputs( "This should not be written to the file.\n", fp ); fprintf( stdout, "This should not be printed on the standard output stream.\n" ); fprintf( stderr, "This should not be printed on the standard error stream.\n" ); fgetc( stdin ); /* This should not block for input. */ return 0; }