strtoul.c

来自「test file nucleus source」· C语言 代码 · 共 95 行

C
95
字号
/***************************************************************************               Copyright Mentor Graphics Corporation 2002*                         All Rights Reserved.** THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS* SUBJECT TO LICENSE TERMS.**************************************************************************//************************************************************************** FILE NAME                                     VERSION**       strtoul.c                               Nucleus Common Library 1.1** DESCRIPTION**       This file contains the implementation of NCL_stroul.** DATA STRUCTURES**       None.** FUNCTIONS**       NCL_stroul** DEPENDENCIES**       ncl.h*       convert.h*       ctype.h*       nucleus.h*************************************************************************/#define NU_NCL_SOURCE_FILE#include "ncl\inc\ncl.h"#include "ncl\inc\convert.h"#include "ncl\inc\ctype.h"#include "plus\nucleus.h"                                /* MMU Support *//***************************************************************************   FUNCTION**       NCL_strtoul**   DESCRIPTION**       This routine scans a string for an unsigned long integer.  The*       integer may be preceeded by optional whitespace characters, and*       by a single '+' or '-' sign.  The integer is in the base specified*       (from base 2 to 36).  If "base" is 0, then the integer is octal if*       preceeded by '0', hexadecimal if '0x', or decimal by default.*       A hexadecimal number may optionally be preceeded by "0x".*       If "endptr" is non-zero, it is set to point to the first invalid*       character found after the integer, or to nptr if a valid integer*       can't be scanned from the string.**   INPUTS**       nptr                The start of the string to be processed*       base                The number system to use (binary, hex, etc...)**   OUTPUTS**       endptr              The first valid character after the integer*                             (passed by reference)*       ulong               The unsigned long represented by the string**************************************************************************/ulong NCL_strtoul (const char *nptr, char **endptr, int  base){    register const uchar *ptr = (const uchar *)nptr;    ulong   value;    while (NCL_isspace (*ptr))        ++ptr;                                  /* skip over whitespace */    value = NCL__strtoul ((const char*)ptr, endptr, base, -1, ULONG_MAX);    if (endptr != (char**) 0)                 /* indicate any errors */    {      if (*endptr == (char*)ptr)          *endptr = (char *)nptr;    }    return (value);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?