Computer programming - Lab 8

1. Implement your own version of the strtol function (initially for base 10, then for any base up to 36).

2. Write a function that takes as parameter a string and fills an array with addresses to the beginning of each (whitespace-separated) word in the string (similar to the argv[] array of main). The array and its available length are also given as parameters. Terminate the array with a NULL pointer after the last valid address.

3. Write a function that takes a NULL-terminated array of strings (char *), another string buf and a maximal length, and concatenates all strings from the array into buf, separated by one space, without exceeding the length limit. Avoid strcat and maintain a pointer to the end of the string being constructed.

4. Implement a function sscanprint having two parameters with the same meaning as in sscanf, but which simply prints the fields matched according to the format, one per line. Implement the format specifiers %d, %f and %MAXs, regular characters and whitespace. Return the same value as sscanf.


Marius Minea
Last modified: Tue Nov 11 16:45:00 EET 2014