How to save data to a file using FILES in C???
pls show me some formats...
Printable View
How to save data to a file using FILES in C???
pls show me some formats...
Code:#include <stdio.h>
#include <fcntl.h>
#include <string.h>
typedef int FLIES;
int main (int argc, char *argv[]) {
char content[]="data";
FLIES away=open(argv[1],O_WRONLY | O_CREAT), x=1;
if (!(argv[1])) { puts("You didn't specify a filename."); return -1; }
if (write(away,content,strlen(content))<3) perror("write");
close(away);
return 0;
}