1#include <fcntl.h>
2#include <errno.h>
3#include <stdio.h>
4#include <sys/stat.h>
5#include <sys/types.h>
6#include <unistd.h>
7
8int main(void)
9{
10    int fd;
11
12    if ((fd = open("this_file_does_not_exist.txt", O_RDONLY)) == -1) {
13        if (errno == ENOENT) {
14            printf("File does not exist.\n");
15        } else {
16            printf("Unknown error code %d\n", errno);
17        }
18    }
19    return 0;
20}
21

Archive Download this file

Attachment to issue 97

Created: 8 years 9 months ago by Juan ComesaƱa



interactive