2
0

setvbuf.c 309 B

123456789101112131415
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "test_helpers.h"
  4. int main(void) {
  5. setvbuf(stdout, 0, _IONBF, 0);
  6. FILE *f = fopen("stdio/stdio.in", "r");
  7. setvbuf(f, 0, _IONBF, 0);
  8. printf("%c\n", fgetc(f));
  9. ungetc('H', f);
  10. char *in = malloc(30);
  11. printf("%s\n", fgets(in, 30, f));
  12. printf("Hello\n");
  13. }