Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
File open with C language
#include <stdio.h>
int main (void)
{
FILE *fp;
fp = fopen ("/home/tsu-nera/tmp/test", "w");
fclose (fp);
return 0;
}
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main (void)
{
int fd;
fd = open ("/home/tsu-nera/tmp/test", O_RDWR|O_CREAT, S_IREAD | S_IWRITE);
close (fd);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment