| 13 | #include <sys/stat.h> |
| 14 | |
| 15 | void create_file(const char *path, const char *buffer, int mode) { |
| 16 | int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode); |
| 17 | assert(fd >= 0); |
| 18 | |
| 19 | int err = write(fd, buffer, sizeof(char) * strlen(buffer)); |
| 20 | assert(err == (sizeof(char) * strlen(buffer))); |
| 21 | |
| 22 | close(fd); |
| 23 | } |
| 24 | |
| 25 | void setup() { |
| 26 | create_file("file", "abcdef", 0777); |