Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <fcntl.h>
  2. #include <unistd.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. void data_create(char *filename);
  7. void pos_create(char *filename);
  8.  
  9.  
  10. int main(int argc, char*argv[])
  11. {
  12.  
  13.  
  14.  
  15. }
  16.  
  17. void data_create(char *filename)
  18. {
  19. int fd1;
  20.  
  21. if ((fd1 = open(filename, O_CREAT| O_RDWR | O_TRUNC | O_APPEND, S_IRWXU)) == -1) {
  22. write(2,"file error...\n",20);
  23. _exit(1);
  24.  
  25. }
  26. close(fd1);
  27. }
  28.  
  29. void pos_create(char *filename)
  30. {
  31. int fd2;
  32. if ((fd2 = open(filename, O_CREAT| O_RDWR | O_TRUNC | O_APPEND, S_IRWXU)) == -1) {
  33. write(2,"file error...\n",20);
  34. _exit(1);
  35.  
  36. }
  37. close(fd2);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement