There's an answer to this question going around and let me tell you that it's NOT CORRECT! If someone is going to answe

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

There's an answer to this question going around and let me tell you that it's NOT CORRECT! If someone is going to answe

Post by answerhappygod »

There's an answer to this question going around and let me tellyou that it's NOT CORRECT! If someone is going to answer thispost, PLEASE try and answer the question and don't just copy andpaste. The answer floating around may achieve the same goalthat the question is asking for, but it does NOT do it the way thequestions is asking. This is asking you to create twofunctions, myfgets and myfputs WITHOUT using c functions. ONLY LINUX I/O SYSTEM CALLS CAN BE USED!!!
That means NO USING: fgets(), fputs() etc. USING THESEDEFEATS THE ENTIRE PURPOSE OF THE QUESTION!
The question is basically asking you to make your OWN VERSION offgets and fputs using YOUR OWN FUNCTIONS
Thanks.
There S An Answer To This Question Going Around And Let Me Tell You That It S Not Correct If Someone Is Going To Answe 1
There S An Answer To This Question Going Around And Let Me Tell You That It S Not Correct If Someone Is Going To Answe 1 (196.67 KiB) Viewed 21 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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply