From aad798d9df7417009fa4438aac61ac8e0e4ded36 Mon Sep 17 00:00:00 2001 From: radiohotline Date: Sat, 14 Mar 2026 16:20:47 +0300 Subject: first commit --- src/cp.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/cp.c (limited to 'src/cp.c') diff --git a/src/cp.c b/src/cp.c new file mode 100644 index 0000000..573677d --- /dev/null +++ b/src/cp.c @@ -0,0 +1,28 @@ +#include + +int main(int argc, char* argv[]) { + FILE *input, *output; + char ch; + + if (argv[2] == NULL) { + printf("specify a destination\n"); + return 1; + } + + input = fopen(argv[1], "r"); + output = fopen(argv[2], "a"); + + if (input == NULL || output == NULL) { + printf("failed to open the file dingus\n"); + return 1; + } else { + while ((ch = fgetc(input)) != EOF) { + fputc(ch, output); + } + } + + fclose(input); + fclose(output); + + return 0; +} -- cgit v1.3