Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/stat.h>
  4. #include <fcntl.h>
  5. #include <errno.h>
  6. #include <unistd.h>
  7. #include <string.h>
  8. int main(int argc, char*argv[])
  9. {
  10. int fd;
  11. int a;
  12. int rozmiar=180;
  13. char buf[180];
  14.  
  15. int f1;
  16. int pomoc;
  17. if(argc!=3)
  18. {
  19. printf("zla liczba argumentow");
  20. }
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. else
  28. {
  29.  
  30.  
  31. fd=creat(argv[1], 0644);
  32. //tu powinno byc cos z tym errno ale nwm co //
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. f1=open(argv[2], 0644);
  40.  
  41.  
  42.  
  43. while(a= read(f1,buf,rozmiar)) //czytamy z pliku
  44. {
  45. write(fd,buf,rozmiar); //zapisujemy do pliku
  46. rozmiar=rozmiar-a;
  47. }
  48.  
  49. printf("koniec zapisywania");
  50.  
  51. }
  52.  
  53.  
  54.  
  55.  
  56.  
  57. getchar ();
  58.  
  59. return 0;
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement