Export (0) Print
Expand All
4 out of 6 rated this helpful - Rate this topic

StrToInt function

Converts a string that represents a decimal value to an integer. The StrToLong macro is identical to this function.

Syntax


int StrToInt(
  _In_  PCTSTR pszSrc
);

Parameters

pszSrc [in]

Type: PCTSTR

A pointer to the null-terminated string to be converted. A valid string representing a decimal value contains only the characters 0-9 and must have the following form to be parsed successfully.

(optional white space)(optional sign)(one or more decimal digits)

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

Return value

Type: int

Returns the int value represented by pszSrc. For instance, the string "123" returns the integer value 123.

Remarks

If the string pointed to by pszSrc 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 decimal string "12b34", StrToInt only recognizes "12" and returns that integer value.

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 4.71 or later)

Unicode and ANSI names

StrToIntW (Unicode) and StrToIntA (ANSI)

See also

StrToIntEx

 

 

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

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.