From 2a5a57e16f216a9bf8933345014c91f198bb1215 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 15 May 2023 15:55:53 +0530 Subject: 8.1: initial commit --- 8.1/filecopy.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 8.1/filecopy.c (limited to '8.1/filecopy.c') diff --git a/8.1/filecopy.c b/8.1/filecopy.c new file mode 100644 index 0000000..b35ccbd --- /dev/null +++ b/8.1/filecopy.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include +#include "filecopy.h" +#include "error.h" + +void filecopy(int ifd, int ofd) +{ + ssize_t n; + char buff[BUFSIZ]; + + while ((n = read(ifd, buff, BUFSIZ)) > 0) + if (write(ofd, buff, n) != n) + error("cat: write error"); +} -- cgit v1.2.3