Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<sys/file.h>
- #include<sys/types.h>
- #include<sys/stat.h>
- #include<unistd.h>
- #include<stdio.h>
- int main()
- {
- char t[100],f[30];
- int i=0, fd;
- printf("Enter a text:\n");
- while((t[i++]=getchar())!='\n');
- t[--i]='\0';
- printf("\nEnter new file name: ");
- scanf("%s",f);
- fd=creat(f,S_IWUSR);
- if(fd==-1)
- return 1;
- write(fd,t,i);
- close(fd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement