Prev, Top Notes, Next

Errors Messages as Finesse

$ ./stupid
open "some/file": No such file or directory

$
 

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