⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strtoll.c

📁 KPIT GNU Tools is a set of GNU development tools for Renesas microcontrollers.
💻 C
字号:
/*FUNCTION   <<strtoll>>---string to long longINDEX	strtollINDEX	_strtoll_rANSI_SYNOPSIS	#include <stdlib.h>        long long strtoll(const char *<[s]>, char **<[ptr]>,int <[base]>);        long long _strtoll_r(void *<[reent]>,                        const char *<[s]>, char **<[ptr]>,int <[base]>);TRAD_SYNOPSIS	#include <stdlib.h>	long long strtoll (<[s]>, <[ptr]>, <[base]>)        const char *<[s]>;        char **<[ptr]>;        int <[base]>;	long long _strtoll_r (<[reent]>, <[s]>, <[ptr]>, <[base]>)	char *<[reent]>;        const char *<[s]>;        char **<[ptr]>;        int <[base]>;DESCRIPTIONThe function <<strtoll>> converts the string <<*<[s]>>> toa <<long long>>. First, it breaks down the string into three parts:leading whitespace, which is ignored; a subject string consistingof characters resembling an integer in the radix specified by <[base]>;and a trailing portion consisting of zero or more unparseable characters,and always including the terminating null character. Then, it attemptsto convert the subject string into a <<long long>> and returns theresult.If the value of <[base]> is 0, the subject string is expected to looklike a normal C integer constant: an optional sign, a possible `<<0x>>'indicating a hexadecimal base, and a number. If <[base]> is between2 and 36, the expected form of the subject is a sequence of lettersand digits representing an integer in the radix specified by <[base]>,with an optional plus or minus sign. The letters <<a>>--<<z>> (or,equivalently, <<A>>--<<Z>>) are used to signify values from 10 to 35;only letters whose ascribed values are less than <[base]> arepermitted. If <[base]> is 16, a leading <<0x>> is permitted.The subject sequence is the longest initial sequence of the inputstring that has the expected form, starting with the firstnon-whitespace character.  If the string is empty or consists entirelyof whitespace, or if the first non-whitespace character is not apermissible letter or digit, the subject string is empty.If the subject string is acceptable, and the value of <[base]> is zero,<<strtoll>> attempts to determine the radix from the input string. Astring with a leading <<0x>> is treated as a hexadecimal value; a string witha leading 0 and no <<x>> is treated as octal; all other strings aretreated as decimal. If <[base]> is between 2 and 36, it is used as theconversion radix, as described above. If the subject string begins witha minus sign, the value is negated. Finally, a pointer to the firstcharacter past the converted subject string is stored in <[ptr]>, if<[ptr]> is not <<NULL>>.If the subject string is empty (or not in acceptable form), no conversionis performed and the value of <[s]> is stored in <[ptr]> (if <[ptr]> isnot <<NULL>>).The alternate function <<_strtoll_r>> is a reentrant version.  Theextra argument <[reent]> is a pointer to a reentrancy structure.RETURNS<<strtoll>> returns the converted value, if any. If no conversion wasmade, 0 is returned.<<strtoll>> returns <<LONG_LONG_MAX>> or <<LONG_LONG_MIN>> if the magnitude ofthe converted value is too large, and sets <<errno>> to <<ERANGE>>.PORTABILITY<<strtoll>> is nonstandard.No supporting OS subroutines are required.*//*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the University of *	California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#include <_ansi.h>#include <limits.h>#include <ctype.h>#include <errno.h>#include <stdlib.h>#include <reent.h>#ifndef _REENT_ONLYlong long_DEFUN (strtoll, (s, ptr, base),	_CONST char *s _AND	char **ptr _AND	int base){	return _strtoll_r (_REENT, s, ptr, base);}#endif

⌨️ 快捷键说明

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