21 lines
324 B
C
21 lines
324 B
C
|
|
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
int main(int argc, char *argv[]) {
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Usage: ./opener [FILENAME]");
|
|
return 1;
|
|
}
|
|
|
|
int fd = open(argv[1], O_RDWR | O_CREAT);
|
|
if (fd == -1) {
|
|
perror("Cannot open file");
|
|
return 1;
|
|
}
|
|
close(fd);
|
|
|
|
return 0;
|
|
}
|