That function doesn't have any way to signal overflow to the caller. It merely
multiplies by 10 and adds a new number for each digit it encounters until it
reaches a non-digit in the character stream.

I guess I can't post the source code to StrAToI, even though you are free to
download it from our Web site. However, imagine that it looks something like the
following (taken from the Microsoft Visual C++ runtime library's atoi()
function; note that this function also overflows):

        while (isdigit(c)) {
            total = 10 * total + (c - '0');     /* accumulate digit */
            c = (int)(unsigned char)*nptr++;    /* get next char */
        }

-- Keith Rollin
-- Palm OS Emulator engineer






pete moss <[EMAIL PROTECTED]> on 06/25/99 01:50:59 AM

Please respond to [EMAIL PROTECTED]

Sent by:  pete moss <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:    (Keith Rollin/HQ/3Com)
Subject:  StrAToI() out of bounds




anyone know what StrAToI returns if the Input string is greater than the
range of an Int?  the docs dont say and i am getting weird results.

:P






Reply via email to