Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rdemeter
GitHub Repository: rdemeter/so
Path: blob/master/lab2/io-01.c
221 views
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <sys/types.h>
4
#include <sys/stat.h>
5
#include <fcntl.h>
6
7
int main()
8
{
9
int fd1, fd2;
10
fd1 = open ("alina.txt", O_WRONLY | O_TRUNC);
11
if (fd1 < 0) {
12
perror ("open alina.txt");
13
exit (EXIT_FAILURE);
14
}
15
16
fd2 = open ("dan.txt", O_RDWR | O_CREAT, 0644);
17
if (fd2 < 0) {
18
perror ("open dan.txt");
19
exit (EXIT_FAILURE);
20
}
21
}
22
23
24