What if this function is called with, say 'Z' as an argument? You must
take all possible cases into account. So, for example, after your
last
if statement, you could put
Code:
else {
cout << "Error in atohex(), illegal argument <" << c << ">" << endl;
return -1; // or return anything that the calling routine can test
}
Dave