Question: uhhhCmain.c Notes ( C version: see Cmain.c ) - PA 7 This is a relatively short function. Follow the instructions in the starter code. main

uhhhCmain.c Notes (C version: see Cmain.c)- PA7
This is a relatively short function. Follow the instructions in the starter code. main() calls setup() to parse the command line arguments, open the bookfile and set the func() pointer to point at either ecrypt() or dcrypt(). Be aware that when calling setup() there are two output parameters (you are passing addresses of main() stack variables) to the function setup() to change.
CSE 30 PA7-8
1015
setup() returns RETRN_FAIL if there is an error. Important: If setup() fails, then both output variables, fpbook and func, are set to contain NULL. So you do not fclose(fpbook).
main() I/O loop consists of the following three steps:
call rdbuf() to fill the inbuf (from stdin) and bookbuf (from bookfp) with the same number of characters. If 0 is returned EOF was reached on stdin.
Call the function pointed at by func() to encrypt or decrypt inbuf.
Call fwrite() to write inbuf to stdout. You should cast the return value of fwrite to an int to suppress compiler warnings (int)fwrite() and the I/O sizes are small.
Make sure to always fclose(fdbook) regardless of what rdbuf() returns and then return either EXIT_SUCCESS (if all ok) or EXIT_FAILURE otherwise.
 uhhhCmain.c Notes (C version: see Cmain.c)- PA7 This is a relatively

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!