|
|
1.1 ! root 1: ! 2: ! 3: strtol() General Function strtol() ! 4: ! 5: ! 6: ! 7: ! 8: Convert string to long integer ! 9: ! 10: #iinncclluuddee <ssttddlliibb.hh> ! 11: lloonngg ssttrrttooll(_s_t_r_i_n_g, _t_a_i_l_p_t_r, _b_a_s_e) ! 12: char *_s_t_r_i_n_g; cchhaarr **_t_a_i_l_p_t_r; iinntt _b_a_s_e; ! 13: ! 14: ssttrrttooll converts the number given in _s_t_r_i_n_g to a lloonngg and returns ! 15: its value; it is a more general version of the function aattooll. ! 16: ssttrrttooll also stores a pointer to the first character following the ! 17: number through _t_a_i_l_p_t_r, provided _t_a_i_l_p_t_r is not NNUULLLL. ! 18: ! 19: _b_a_s_e gives the base of the number being read, either 0 or a value ! 20: from 2 to 36. If the given _b_a_s_e is zero, ssttrrttooll determines an ! 21: implicit base for the number: hexadecimal if the number starts ! 22: with 00xx or 00XX, octal if the number starts with 00, or decimal ! 23: otherwise. Alternatively, you can specify a _b_a_s_e between 2 and ! 24: 36. ! 25: ! 26: ssttrrttooll parses _s_t_r_i_n_g into three portions: beginning, subject ! 27: sequence, and tail. ! 28: ! 29: The _b_e_g_i_n_n_i_n_g consists of zero or more white-space characters ! 30: that begin the string. ! 31: ! 32: The _s_u_b_j_e_c_t _s_e_q_u_e_n_c_e is the portion of the string that ssttrrttooll ! 33: converts into a lloonngg. It consists of an optional sign character, ! 34: an optional prefix 00xx or 00XX if the _b_a_s_e is 16, and a nonempty ! 35: sequence of _d_i_g_i_t_s in the specified base. For example, if the ! 36: _b_a_s_e is 16, then ssttrrttooll recognizes numeric characters `0' to `9' ! 37: and alphabetic characters `A' through `F' and `a' to `f' as ! 38: digits. It continues to scan until it encounters a nondigit. ! 39: ! 40: The _t_a_i_l continues from the end of the subject sequence to the ! 41: null character that ends the string. ! 42: ! 43: ssttrrttooll ignores the beginning portion of the string. It converts ! 44: the subject sequence to a lloonngg. Finally, if _t_a_i_l_p_t_r is not NNUULLLL, ! 45: it sets the pointer pointed to by _t_a_i_l_p_t_r to the address of the ! 46: first character of the string's tail. ! 47: ! 48: ssttrrttooll returns a lloonngg representing the value of the subject ! 49: sequence. If the input _s_t_r_i_n_g does not specify a valid number, ! 50: it returns zero and stores the initial value of _s_t_r_i_n_g through ! 51: _t_a_i_l_p_t_r. If the number it builds is too large or too small to fit ! 52: into a lloonngg, it sets the global variable eerrrrnnoo to the value of ! 53: the macro EERRAANNGGEE and returns LLOONNGG_MMAAXX or LLOONNGG_MMIINN, respectively. ! 54: ! 55: ***** See Also ***** ! 56: ! 57: aattooll, eerrrrnnoo, ggeenneerraall ffuunnccttiioonnss, lliimmiittss.hh, lloonngg, ssttddlliibb.hh, ssttrrttoouull ! 58: ! 59: ***** Notes ***** ! 60: ! 61: ssttrrttooll ignores initial white space in the input _s_t_r_i_n_g. White ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: strtol() General Function strtol() ! 70: ! 71: ! 72: ! 73: space is defined as being all characters so recognized by the ! 74: function iissssppaaccee. ! 75: ! 76: ! 77: ! 78: ! 79: ! 80: ! 81: ! 82: ! 83: ! 84: ! 85: ! 86: ! 87: ! 88: ! 89: ! 90: ! 91: ! 92: ! 93: ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: ! 100: ! 101: ! 102: ! 103: ! 104: ! 105: ! 106: ! 107: ! 108: ! 109: ! 110: ! 111: ! 112: ! 113: ! 114: ! 115: ! 116: ! 117: ! 118: ! 119: ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.