11.07.2015 Views

CrossWorks for ARM User Guide

CrossWorks for ARM User Guide

CrossWorks for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

First, strtol decomposes the input string into three parts: an initial, possibly empty,sequence of white-space characters (as specified by isspace (page 246)), a subjectsequence resembling an integer represented in some radix determined by the value ofbase, and a final string of one or more unrecognized characters, including theterminating null character of the input string. strtol then attempts to convert thesubject sequence to an integer, and return the result.When converting, no integer suffix (such as U, L, UL, LL, ULL) is allowed.If the value of base is zero, the expected <strong>for</strong>m of the subject sequence is an optional plusor minus sign followed by an integer constant.If the value of base is between 2 and 36 (inclusive), the expected <strong>for</strong>m of the subjectsequence is an optional plus or minus sign followed by a sequence of letters and digitsrepresenting an integer with the radix specified by base. The letters from a (or A)through z (or Z) represent the values 10 through 35; only letters and digits whoseascribed values are less than that of base are permitted.If the value of base is 16, the characters '0x' or '0X' may optionally precede thesequence of letters and digits, following the optional sign.The subject sequence is defined as the longest initial subsequence of the input string,starting with the first non-white-space character, that is of the expected <strong>for</strong>m. Thesubject sequence contains no characters if the input string is empty or consists entirelyof white space, or if the first non-white-space character is other than a sign or apermissible letter or digit.If the subject sequence has the expected <strong>for</strong>m and the value of base is zero, thesequence of characters starting with the first digit is interpreted as an integer constant.If the subject sequence has the expected <strong>for</strong>m and the value of base is between 2 and36, it is used as the base <strong>for</strong> conversion.If the subject sequence begins with a minus sign, the value resulting from theconversion is negated.A pointer to the final string is stored in the object pointed to by endptr, provided thatendptr is not a null pointer.If the subject sequence is empty or does not have the expected <strong>for</strong>m, no conversion isper<strong>for</strong>med, the value of nptr is stored in the object pointed to by endptr, provided thatendptr is not a null pointer.strtol returns the converted value, if any. If no conversion could be per<strong>for</strong>med, zero isreturned. If the correct value is outside the range of representable values, LONG_MIN(page 250) or LONG_MAX (page 250) is returned according to the sign of the value, ifany, and the value of the macro errno (page 247) is stored in errno (page 247).Portabilitystrtol con<strong>for</strong>ms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99).Chapter 28 - General utilities305

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!