all.c 684 B

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "test_helpers.h"
  4. int main(void) {
  5. FILE *f = fopen("stdio/stdio.in", "r");
  6. ERROR_IF(fopen, f, == NULL);
  7. int c = fgetc(f);
  8. ERROR_IF(fgetc, c, == EOF);
  9. UNEXP_IF(fgetc, c, < 0);
  10. UNEXP_IF(fgetc, c, > 255);
  11. printf("%c\n", c);
  12. int u = ungetc('J', f);
  13. ERROR_IF(ungetc, u, == EOF);
  14. char in[30] = { 0 };
  15. char *s = fgets(in, 30, f);
  16. ERROR_IF(fgets, s, == NULL);
  17. printf("%s\n", in);
  18. __attribute__((unused)) int vb = setvbuf(stdout, 0, _IONBF, 0);
  19. //ERROR_IF(setvbuf, vb, > 0); // TODO: Cannot use this, doesn't set errno
  20. //UNEXP_IF(setvbuf, vb, != 0);
  21. printf("Hello\n");
  22. }