Computer programming - Lab 9

1. Write a function int myscanf(const char *fmt, void *adrtab[]) that works like scanf, but receives a NULL-terminated array of void * pointers, the addresses of objects to be read. Accept only selected format specifiers as stated below; any error encountered in the format, or reaching the NULL terminator in the address array should terminate reading. You may use scanf to read individual objects.
a) accept only format specifiers %d and %lf
b) accept only format specifiers of the form %MAXs where MAX is an unsigned constant

2. Write a function that takes as parameter a string buf, a character c and a string str and returns a dynamically allocated string obtained from buf by substituting every occurrence of c with str.

3. Write a function that takes as parameter a string buf, a string str and a character c and returns a dynamically allocated string obtained from buf by substituting every occurrence of str with c.

4. Write a function that reads an arbitrarily long text and returns a NULL-terminated array of pointers (char *) to text lines. Lines longer than 80 chars will be split.

Marius Minea
Last modified: Wed Nov 20 7:50:00 EET 2013