Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. //#include <sys/types.h>
  2. //#include <sys/stat.h>
  3. #include <fcntl.h>
  4. #include <stdlib.h>
  5. //#include <unistd.h>
  6. int main(int argc, char* argv[])
  7. {
  8.  
  9. int fileFrom=open(argv[1],O_RDONLY);
  10. int fileTo=open("test5.txt",O_RDWR|O_CREAT| O_TRUNC| O_APPEND);
  11. char *buff=malloc(1);
  12.  
  13. if(fileTo==-1 || fileFrom==-1)
  14. perror("zjebalo sie");
  15.  
  16. while(read(fileFrom,buff,1))
  17. {
  18. if(*buff>='A' &&*buff<='Z')
  19. *buff=*buff+32;
  20.  
  21. if(write(fileTo,buff,1))
  22. printf("writing...\n");
  23.  
  24. }
  25. free(buff);
  26. close(fileTo);
  27. close(fileFrom);
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement