summaryrefslogtreecommitdiff
path: root/wk4/lect/cp.c
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-27 22:11:55 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-02-27 22:11:55 +0000
commitaf9eb27e551ffffb12d18bc37eca7302370b8923 (patch)
tree426f6915ab194634aae5c7a61d2c6ec36623f710 /wk4/lect/cp.c
parenta404ce27a7ecc48a882f54209162fa08c38df38f (diff)
Tue, Feb 27, 2024, 2:11 PM -08:00
Diffstat (limited to 'wk4/lect/cp.c')
-rw-r--r--wk4/lect/cp.c24
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);
+}