| 19 | #include <sys/types.h> |
| 20 | |
| 21 | void create_file(const char *path, const char *buffer, int mode) { |
| 22 | int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode); |
| 23 | assert(fd >= 0); |
| 24 | |
| 25 | int err = (int)write(fd, buffer, sizeof(char) * strlen(buffer)); |
| 26 | assert(err == (sizeof(char) * strlen(buffer))); |
| 27 | |
| 28 | close(fd); |
| 29 | } |
| 30 | |
| 31 | void setup() { |
| 32 | create_file("file", "abcdef", 0777); |