const char *filename = "some/file"; int fd = open(filename, O_RDONLY); if (fd < 0) { fprintf("open \"%s\": %s\n", filename, strerror(errno)); exit(1); }