Programming in C autumn 2009
Exercise 6
To the exam you may take one A4 paper, where you have made your own notes.
You can use both sides of the paper.
Return the module of your project work at the latest Oct. 12th.
The course page will have guidance about feedback and to whom
to give feedback on 14.10.
You should give your feedback by Oct. 21st.
Project work should be returned by no later than Nov. 9th.
Oct. 19 2009
#define MAX 100 char* storage[MAX];input() reads the file fname and stores storage lines from this file in the array. Do not make any assumptions about the length of input lines (use a function getline() from Example 10-3). The function input() should then remove all lines that are empty (contain only the end-of-line character, possibly preceded by whitespace characters.) from this array, and report the number of lines that have been removed. Then write the main function which calls input(), and then outputs the contents of the array storage to the standard output stream.
void PrintGen(const void *block, size_t elemSize, size_t blockSize, void (*printIt) (const void*));which prints all elements in the block using the "callback" function printIt. Use the "Traversing a Block of Objects" idiom. Test your program using a block of doubles, and a block of pointers to doubles.
program file1 -dor
program file1In the first case, this program will display on the standars output the first d lines from the file file1. In the second case, it will display up to the first 20 lines from this file. If anything goes wrong (for example, the file file1 does not exist, or d is not an integer value), an error message should be displayed.