Trying and failing to use fcloseall
.
This commit is contained in:
parent
11139d2f67
commit
3b738faa65
27
ex24_iofunctions04.c
Normal file
27
ex24_iofunctions04.c
Normal file
@ -0,0 +1,27 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include "dbg.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int rc = -1;
|
||||
printf("This should be visible, I think.\n");
|
||||
|
||||
rc = fcloseall();
|
||||
check(rc == 0, "Failed to close all io streams.");
|
||||
printf("I've used `fcloseall`, so this should not be visible, right?\n");
|
||||
|
||||
rc = fflush(stdout);
|
||||
check(rc != EOF, "Failed to flush stdout.");
|
||||
printf("Maybe we won't see anything after I explicitly `fflush(stdout)`?\n");
|
||||
|
||||
rc = fclose(stdout);
|
||||
check(rc != EOF, "Failed to explicitly close stdout.");
|
||||
printf("This had better not show up, right?\n");
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user