ReactOS  0.4.15-dev-1070-ge1a01de
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 _SPACE
Definition: ctype.h:68
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
static const WCHAR L[]
Definition: oid.c:1250