> (atio will not work for hex values)
The atoi function is actually pretty brain-dead, so if you do not know
for certain that your numeric base is decimal, you should use strtol
instead, since it can be passed a base.
Also, if the given base is zero it makes a fairly convincing stab at
guessing the correct base.
I think the man pages actually say this, now I think of it...
Attached example:
#include <stdlib.h>
#include <stdio.h>
int main(void) {
char *txt = "0x0000AA55";
int v;
puts(txt);
v = atoi(txt);
printf("v is : %d (atoi is explicitly base 10)\n", v);
v = (int)strtol(txt, 0, 0);
printf("v is : %d or 0x%08X (strtol handles number base OK)\n",
v, v);
return 0;
}
/* end of file */
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk