Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>cton()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
CTON()

Syntax:     CTON(<expC>[,<expN>][,<expL>])

Arguments:  <expC> is a string of digits, which is converted to a number
            to the base <expN>.
            <expN> denotes the base to be used for converting the
            string of digits (from base 2 to 36).
            <expL>  determines whether the number is to be signed or
            unsigned.

Returns:    A numeric value.
            The function returns the number corresponding to the string.

Usage:      CTON() provides full facilities for converting a string of digits
            into a numeric value.  It is possible to convert any valid
            to the base  selected via <expN>.

Notes:      Base 10 is assumed if the argument <expN> is not passed.  If
            is (.F.) the return value will be between 0 and 65535, or if
            it is (.T.), it will be between -32768 and 32767.

            The string is automatically trimmed of leading and trailing
            blanks.  The function returns 0 if invalid arguments are
            supplied.

Library:    CT1.LIB


--------------------------------- Example ------------------------------

Examples:   * Conversion using base 10
            ? CTON("60000")                     && Result: 60000

            * Conversion using base 2
            ? CTON("11",2)                      && Result: 3
            ? CTON("11101010011000000",2)       && Result: 60000

            * Conversion using base 16
            ? CTON("A",16)                      && Result: 10
            ? CTON("ABCD",16)                   && Result: 43981
            ? CTON("FFFF",16,.T.)               && Result: -1

            * Conversion using base 36
            ? CTON("XXP",36)                    && Result: 43981



See Also: NTOC()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson