Linux 4
LeeMir, 27 September 2018
Linux C 프로그래밍 - 파일 입출력
#include <stdio.h>
#include <fcntl.h>
int main(void)
{
char *fname = "test.txt";
int fd;
fd = creat(fname,0666); // permission 000110110110
if(fd < 0)
perror("create()");
else
{
printf("Success!\n Filename: %s, fd: %d\n", fname,fd);
close(fd);
}
return 0;
}