...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> #include <unistd.h> #include <fcntl.h> void open_some_file(const char *file) { int fd = open(file, O_CREAT | O_EXCL | O_WRONLY); if (-1 != fd) { FILE *f = fdopen(fd, "w"); if (NULL != f) { /* Write to file */ ifif (fclose(f) == EOF) { /* Handle error */ } } if (close(fd) == -1) {else /* Handle error */ }close(fd); } } |
Noncompliant Code Example (POSIX read)
...