diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-27 22:11:55 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-02-27 22:11:55 +0000 |
commit | af9eb27e551ffffb12d18bc37eca7302370b8923 (patch) | |
tree | 426f6915ab194634aae5c7a61d2c6ec36623f710 /wk4/lect/cp.c | |
parent | a404ce27a7ecc48a882f54209162fa08c38df38f (diff) |
Tue, Feb 27, 2024, 2:11 PM -08:00
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); +} |