Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <fcntl.h>
  4. #include <unistd.h>
  5. #include <iostream>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9.     if (argc == 1)
  10.     {
  11.         cout << "I need dem doges and dem patriots poi" << endl;
  12.         return -1;
  13.     }
  14.  
  15.     char *doge = argv[2];
  16.     char *patriot = argv[1];
  17.     int wfd = open(patriot, O_WRONLY);
  18.     int rfd = open(doge, O_RDONLY);
  19.     char *buffer = new char[1024];
  20.     int bytes_read;
  21.     while(1)
  22.     {
  23.         while ((bytes_read = read(rfd, buffer, 1024)) != 0)
  24.         {
  25.             write(wfd, buffer, bytes_read);
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement