|
|
coherent
strtol() General Function strtol() Convert string to long integer #iinncclluuddee <ssttddlliibb.hh> lloonngg ssttrrttooll(_s_t_r_i_n_g, _t_a_i_l_p_t_r, _b_a_s_e) char *_s_t_r_i_n_g; cchhaarr **_t_a_i_l_p_t_r; iinntt _b_a_s_e; ssttrrttooll converts the number given in _s_t_r_i_n_g to a lloonngg and returns its value; it is a more general version of the function aattooll. ssttrrttooll also stores a pointer to the first character following the number through _t_a_i_l_p_t_r, provided _t_a_i_l_p_t_r is not NNUULLLL. _b_a_s_e gives the base of the number being read, either 0 or a value from 2 to 36. If the given _b_a_s_e is zero, ssttrrttooll determines an implicit base for the number: hexadecimal if the number starts with 00xx or 00XX, octal if the number starts with 00, or decimal otherwise. Alternatively, you can specify a _b_a_s_e between 2 and 36. ssttrrttooll parses _s_t_r_i_n_g into three portions: beginning, subject sequence, and tail. The _b_e_g_i_n_n_i_n_g consists of zero or more white-space characters that begin the string. The _s_u_b_j_e_c_t _s_e_q_u_e_n_c_e is the portion of the string that ssttrrttooll converts into a lloonngg. It consists of an optional sign character, an optional prefix 00xx or 00XX if the _b_a_s_e is 16, and a nonempty sequence of _d_i_g_i_t_s in the specified base. For example, if the _b_a_s_e is 16, then ssttrrttooll recognizes numeric characters `0' to `9' and alphabetic characters `A' through `F' and `a' to `f' as digits. It continues to scan until it encounters a nondigit. The _t_a_i_l continues from the end of the subject sequence to the null character that ends the string. ssttrrttooll ignores the beginning portion of the string. It converts the subject sequence to a lloonngg. Finally, if _t_a_i_l_p_t_r is not NNUULLLL, it sets the pointer pointed to by _t_a_i_l_p_t_r to the address of the first character of the string's tail. ssttrrttooll returns a lloonngg representing the value of the subject sequence. If the input _s_t_r_i_n_g does not specify a valid number, it returns zero and stores the initial value of _s_t_r_i_n_g through _t_a_i_l_p_t_r. If the number it builds is too large or too small to fit into a lloonngg, it sets the global variable eerrrrnnoo to the value of the macro EERRAANNGGEE and returns LLOONNGG_MMAAXX or LLOONNGG_MMIINN, respectively. ***** See Also ***** aattooll, eerrrrnnoo, ggeenneerraall ffuunnccttiioonnss, lliimmiittss.hh, lloonngg, ssttddlliibb.hh, ssttrrttoouull ***** Notes ***** ssttrrttooll ignores initial white space in the input _s_t_r_i_n_g. White COHERENT Lexicon Page 1 strtol() General Function strtol() space is defined as being all characters so recognized by the function iissssppaaccee. COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.