stupid atoi() problem
Are you trying to use atoi() or itoa() ( Your subject and example are different ).
If you are trying to use itoa, don''t. Use something like sprintf() instead to go from integer to array.
-------
Andrew
If you are trying to use itoa, don''t. Use something like sprintf() instead to go from integer to array.
-------
Andrew
ahh fuck. im dumb (i did this in the post wrong, not in the code).
atoi("2134AFE");
Will produce the result 2134. Why is this? Should I use atol?
atoi("2134AFE");
Will produce the result 2134. Why is this? Should I use atol?
I think hexidecimal digits are supposed to be prefixed with ''0x'', i.e., ''0x2134afe''. If it''s always supposed to input hexidecimal, use ''strtol("2134afe", 0, 16)''.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement