Skip to content
Snippets Groups Projects
Verified Commit d5a9cd69 authored by Tom Almeida's avatar Tom Almeida
Browse files

Add tests to make sure setvbuf works.

parent 540395c0
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ EXPECT_BINS=\ ...@@ -14,6 +14,7 @@ EXPECT_BINS=\
setjmp \ setjmp \
signal \ signal \
stdio/all \ stdio/all \
stdio/setvbuf \
stdio/freopen \ stdio/freopen \
stdio/fwrite \ stdio/fwrite \
stdio/getc_unget \ stdio/getc_unget \
......
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv) {
setvbuf(stdout, 0, _IONBF, 0);
FILE *f = fopen("stdio/stdio.in", "r");
setvbuf(f, 0, _IONBF, 0);
printf("%c\n", fgetc(f));
ungetc('H', f);
char *in = malloc(30);
printf("%s\n", fgets(in, 30, f));
printf("Hello\n");
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment