fputs.c 371 B

12345678910111213141516171819
  1. #include <stdio.h>
  2. #include <errno.h>
  3. #include "test_helpers.h"
  4. int main(void) {
  5. FILE *f = fopen("stdio/fputs.out", "w");
  6. ERROR_IF(fopen, f, == NULL);
  7. char *in = "Hello World!";
  8. int p = fputs(in, f);
  9. ERROR_IF(fputs, p, == EOF);
  10. UNEXP_IF(fputs, p, < 0);
  11. int c = fclose(f);
  12. ERROR_IF(fclose, c, == EOF);
  13. UNEXP_IF(fclose, c, != 0);
  14. }