Check file handle in C using system calls

This commit is contained in:
Fabio Scotto di Santolo
2025-06-23 17:38:46 +02:00
parent 00a33abc23
commit 85ef4163db
10 changed files with 407 additions and 0 deletions

15
chp2/fopenmode.c Normal file
View File

@@ -0,0 +1,15 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
int main(void)
{
int fd;
fd = open("test.txt", O_CREAT | O_EXCL, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
if (fd == -1)
perror("open");
close(fd);
return 0;
}