2
0

create.c 382 B

123456789101112131415161718
  1. #include <fcntl.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include "test_helpers.h"
  5. int main(void) {
  6. int fd = creat("create.out", 0755);
  7. ERROR_IF(creat, fd, == -1);
  8. UNEXP_IF(creat, fd, < 0);
  9. int written = write(fd, "Hello World!\n", 13);
  10. ERROR_IF(write, written, == -1);
  11. int c = close(fd);
  12. ERROR_IF(close, c, == -1);
  13. UNEXP_IF(close, c, != 0);
  14. }