ReactOS 0.4.15-dev-7942-gd23573b
wtol.c File Reference
#include <string.h>
#include <ctype.h>
#include <basetsd.h>
Include dependency graph for wtol.c:

Go to the source code of this file.

Functions

long _wtol (const wchar_t *str)
 

Function Documentation

◆ _wtol()

long _wtol ( const wchar_t str)

Definition at line 11 of file wtol.c.

12{
13 unsigned long RunningTotal = 0;
14 char bMinus = 0;
15
16 if (str == NULL)
17 return 0;
18
19 while (iswctype(*str, _SPACE) ) {
20 str++;
21 } /* while */
22
23 if (*str == L'+') {
24 str++;
25 } else if (*str == L'-') {
26 bMinus = 1;
27 str++;
28 } /* if */
29
30 while (*str >= L'0' && *str <= L'9') {
31 RunningTotal = RunningTotal * 10 + *str - L'0';
32 str++;
33 } /* while */
34
35 return bMinus ? 0-RunningTotal : RunningTotal;
36}
#define NULL
Definition: types.h:112
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:99
#define _SPACE
Definition: ctype.h:68
#define L(x)
Definition: ntvdm.h:50
const WCHAR * str