Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <fcntl.h>
- #include <unistd.h>
- int main(){
- char buf[512];
- int p, p2, lbajt;
- p=open("/tmp/erykzjeb", O_RDONLY);
- if ( p == -1){
- perror("Blad otwarcia pliku zrodlowego");
- exit(1);
- }
- p2=open("/tmp/zuza", O_WRONLY);
- if ( p2 == -1){
- perror("Blad otwarcia pliku zrodlowego");
- exit(1);
- }
- while((lbajt = read(p, buf, 512)) > 0){
- if (write(p2, buf, lbajt) == -1){
- perror("Blad zapisu pliku docelowego");
- exit(1);
- }
- write(1,buf,lbajt);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement