Last active
August 29, 2015 14:21
-
-
Save ajpen/3fb81274ae024634d6f1 to your computer and use it in GitHub Desktop.
File copying program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main(int argc, char* argv[]){ | |
char buffer; //number of bits copied at once | |
FILE* source = fopen(argv[1],"r"); | |
FILE* dest = fopen(argv[2],"w"); | |
while((fread(&buffer, 1, 1, source)) > 0) { | |
fwrite(&buffer, 1, 1, dest); | |
} | |
fclose(source); | |
fclose(dest); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment