Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

StrToInt64Ex function

Converts a string representing a decimal or hexadecimal value to a 64-bit integer.

Syntax


BOOL StrToInt64Ex(
  _In_   PCTSTR pszString,
  STIF_FLAGS dwFlags,
  _Out_  LONGLONG *pllRet
);

Parameters

pszString [in]

Type: PCTSTR

A pointer to the null-terminated string to be converted. For further details concerning the valid forms of the string, see the Remarks section.

dwFlags

Type: STIF_FLAGS

One of the following values that specify how pszString should be parsed for its conversion to a 64-bit integer.

STIF_DEFAULT

The string at pszString contains the representation of a decimal value.

STIF_SUPPORT_HEX

The string at pszString contains the representation of either a decimal or hexadecimal value. Note that in hexadecimal representations, the characters A-F are case-insensitive.

pllRet [out]

Type: LONGLONG*

A pointer to a variable of type LONGLONG that receives the 64-bit integer value of the converted string. For instance, in the case of the string "123", the integer pointed to by this value receives the value 123.

If this function returns FALSE, this value is undefined.

If the value returned is too large to be contained in a variable of type LONGLONG, this parameter contains the 64 low-order bits of the value. Any high-order bits beyond that are lost.

Return value

Type: BOOL

Returns TRUE if the string is converted; otherwise FALSE.

Remarks

The string pointed to by the pszString parameter must have one of the following forms to be parsed successfully.

  • This form is accepted as a decimal value under either flag.
    (optional white space)(optional sign)(one or more decimal digits)
    
  • These forms are required for hexadecimal values when the STIF_SUPPORT_HEX flag is passed.
    (optional white space)(optional sign)0x(one or more hexadecimal digits)
    
    (optional white space)(optional sign)0X(one or more hexadecimal digits)
    

The optional sign can be the character '-' or '+'; if omitted, the sign is assumed to be positive.

Note  If the value is parsed as hexadecimal, the optional sign is ignored, even if it is a '-' character. For example, the string "-0x1" is parsed as 1 instead of -1.

If the string pointed to by pszString contains an invalid character, that character is considered the end of the string to be converted and the remainder is ignored. For instance, given the invalid hexadecimal string "0x00am123", StrToInt64Ex only recognizes "0x00a", converts it to the integer value 10, and returns TRUE.

If pllRet is NULL, the function returns TRUE if the string can be converted, even though it does not perform the conversion.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 5.0 or later)

Unicode and ANSI names

StrToInt64ExW (Unicode) and StrToInt64ExA (ANSI)

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.