On Tuesday 07 April 2009, Jules Richardson wrote:
Ian King wrote:
I used to ask college grads to write a function
in C to convert a
null-terminated string representing an octal number into an int.
Do you mean that the octal digits are packed one per 3 bits, or that
each item in the string matches to one of the chars '0'..'7'?
I think that he meant a string with ASCII characters (presumably 0-7).
A better answer is "can I use strtol()?" I'd rather hire someone who is
willing to reuse existing code instead of insisting on rewriting
everything him/herself. I've had to deal with things created by the
latter at work. :(
Pat
--
Purdue University Research Computing ---
http://www.rcac.purdue.edu/
The Computer Refuge ---
http://computer-refuge.org