diff options
Diffstat (limited to 'wk4/lect/cp.c')
-rw-r--r-- | wk4/lect/cp.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/wk4/lect/cp.c b/wk4/lect/cp.c new file mode 100644 index 0000000..60ca336 --- /dev/null +++ b/wk4/lect/cp.c @@ -0,0 +1,24 @@ +#include <cs50.h> +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdint.h> + +typedef uint8_t BYTE; + +int main(int argc, char *argv[]) +{ + FILE *src = fopen(argv[1], "rb"); + FILE *dst = fopen(argv[2], "wb"); + + BYTE b; + + while (fread(&b, sizeof(b), 1, src) != 0) + { + fwrite(&b, sizeof(b), 1, dst); + } + + fclose(dst); + fclose(src); +} |