Skip to content

Instantly share code, notes, and snippets.

@tsu-nera
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsu-nera/f0be86e0a704471372b3 to your computer and use it in GitHub Desktop.
Save tsu-nera/f0be86e0a704471372b3 to your computer and use it in GitHub Desktop.
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