36eb719b51
Sometimes it's just nice to open a file, do nothing with it and keep it open forever. Yay.
19 lines
340 B
C
19 lines
340 B
C
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Usage: keepfileopen <file>\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
if (open(argv[1], O_RDONLY) < 0) {
|
|
perror("Failed to open file");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
pause();
|
|
return EXIT_SUCCESS;
|
|
}
|