Question: Question 4 (35 Marks) The following is a code fragment from a program that reads input from the console and runs the corresponding command: Structure

Question 4 (35 Marks) The following is a code fragment from a program that reads input from the console and runs the corresponding command: Structure to hold the command string and // pointer to command function typedef struct uint8t NameString uint8t Function p)(uint8t ArgNum, uinttArgStrings uint8t HelpString Array of commands const command-s commandList[] { "filtcooff", SFiltercoefffunction,"iltcooff), "help. &HelpFunction, "helpl) NULLNULL NULL l 2 Command functions // Function to call the corresponding command uint8_t CallFunction(uinttArgNum, uint8_t ArgStrings[) main () uint8t ArgNun uint8t ArgStrings uint8t Status Status-CallFunction(ArgNum, Argstrings) A command line parser has already been written (not shown in the code fragment) which reads console input and ex tracts words from the command line, returning the number of words ArgNun and an array of strings Argstrings[ containing the words. The function CallFunction takes the returned values from the command line parser and alls the corresponding function from the command list based on the first argument from the command line. The following questions relate to the information provided above Page 10 of 12 ELEC3730 Digital and Computer Electronics 2 Practice Esamination a) The command filtcoeff reads the binary file which contains filter coefficients and prints the details to the console. The details of the file contents are The first four bytes contain an integer n which is in stored in little endian format. The next 8n bytes contain an array of n floating point numbers stored as 8 byte double precision Write the function FilterCoeffFunction) to implement the command. The function should display to the console the value of the integer n and the n floating point numbers. Ensure that the code is robust and will not cause the system to crash even with inconsistent user input

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!