R
rouble
Without using errno, is there a portable way to detect if a string
number is not within the range 0 to 4294967295.
Currently I am using strtoul. I can check the string for "-" as the
first character before calling strtoul, so I can figure out if the
value is less than 0.
My issue arises when the number is greater than 4294967295 on platforms
where ULONG_MAX is 4294967295; in this case strtoul will return
ULONG_MAX and set errno to ERANGE. However, some platforms I work on do
not support errno. So there is no way for me to know that the value was
greater than 4294967295.
Is there another way to do this ?
TIA,
rouble
number is not within the range 0 to 4294967295.
Currently I am using strtoul. I can check the string for "-" as the
first character before calling strtoul, so I can figure out if the
value is less than 0.
My issue arises when the number is greater than 4294967295 on platforms
where ULONG_MAX is 4294967295; in this case strtoul will return
ULONG_MAX and set errno to ERANGE. However, some platforms I work on do
not support errno. So there is no way for me to know that the value was
greater than 4294967295.
Is there another way to do this ?
TIA,
rouble