SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main(int argc, char ** argv) {
  2.  
  3.   if (argc < 2) {
  4.     perror("Too few arguments\n");
  5.     return FUN_FAILLURE;
  6.   }
  7.  
  8.   FILE *src = fopen(argv[1],"r");
  9.   if (src == NULL) {
  10.     perror("Error : source file\n");
  11.     return FUN_FAILLURE;
  12.   }
  13.  
  14.   FILE *dest = fopen("test.txt", "w");
  15.   if (dest == NULL) {
  16.     perror("Error : destination file\n");
  17.     return FUN_FAILLURE;
  18.   }
  19.  
  20.   char *p;
  21.   int rr = fgetc(src);
  22.  
  23.   while (rr != EOF) {
  24.     fwrite(p, sizeof(char), 1, dest);
  25.   }
  26.  
  27.  
  28.  
  29.   return FUN_SUCCESS;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top