NUMPARSE Structure

Flags used by both dwInFlags and dwOutFlags:

NUMPRS_LEADING_WHITE
 NUMPRS_TRAILING_WHITE
 NUMPRS_LEADING_PLUS    
 NUMPRS_TRAILING_PLUS
 NUMPRS_LEADING_MINUS
 NUMPRS_TRAILING_MINUS
 NUMPRS_HEX_OCT
 NUMPRS_PARENS
 NUMPRS_DECIMAL
 NUMPRS_THOUSANDS
 NUMPRS_CURRENCY    
 NUMPRS_EXPONENT
 NUMPRS_USE_ALL
 NUMPRS_STD

Flags used by dwOutFlags only:

NUMPRS_NEG
 NUMPRS_INEXACT

The caller of VarParseNumFromStr must initialize two elements of the passed-in NUMPARSE structure:

typedef struct {
    int    cDig;
    unsigned long    dwInFlags;
    unsigned long    dwOutFlags;
    int    cchUsed;
    int    nBaseShift;
    int    nPwr10;
} NUMPARSE;

The cDig element is set to the size of the rgbDig array, and dwInFlags is set to parsing options. All other elements may be uninitialized and are set by the function, except on error, as described in the following paragraphs. The cDig element is also modified by the function to reflect the actual number of digits written to the rgbDig array.

The cchUsed element of the NUMPARSE structure is filled in with the number of characters (from the beginning of the string) that were successfully parsed. This allows the caller to determine if the entire string was part of the number (as required by functions such as VarI2FromStr), or where to continue parsing the string.

The nBaseShift element gives the number of bits per digit (3 or 4 for octal and hexadecimal numbers, and zero for decimal).

The following apply only to decimal numbers: