Page 1 of 1

Using only the Unix input/output system calls(do not use any standard input/output functions), define two C functions, c

Posted: Sun Jul 03, 2022 11:23 am
by answerhappygod
Using Only The Unix Input Output System Calls Do Not Use Any Standard Input Output Functions Define Two C Functions C 1
Using Only The Unix Input Output System Calls Do Not Use Any Standard Input Output Functions Define Two C Functions C 1 (196.67 KiB) Viewed 20 times
Using only the Unix input/output system calls(do not use any standard input/output functions), define two C functions, called myFgets() and myFputs() with the following requirements: • int myFgets(char *s, int size, int stream): reads in at most one less than size characters from stream (file descriptor is stream) and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline (i.e., reading should be done one byte at a time). If a newline is read, it is stored into the buffer. A terminating null byte is stored after the last character in the buffer. This function returns the number of characters read or, 0 for end of file or -1 in case of error. int my Fputs(const char *s, int *stream), writes the string s to stream, without its terminating null byte. This function returns the number of characters written or -1 in case of error. Then, define your main function to perform a copy task using your defined functions, myFgets() and myF- puts(). Your C program takes two arguments, input file and destination file.