|
|
1.1 ! root 1: .TH ATOF 3 ! 2: .CT 2 data_man math ! 3: .SH NAME ! 4: atof, atoi, atol, strtod, strtol, strtoul \(mi convert ASCII to numbers ! 5: .SH SYNOPSIS ! 6: .nf ! 7: .B double atof(nptr) ! 8: .B char *nptr; ! 9: .PP ! 10: .B int atoi(nptr) ! 11: .B char *nptr; ! 12: .PP ! 13: .B long atol(nptr) ! 14: .B char *nptr; ! 15: .PP ! 16: .B double strtod(nptr, rptr) ! 17: .B char *nptr, **rptr; ! 18: .PP ! 19: .B "long strtol(nptr, rptr, base) ! 20: .B char *nptr, **rptr; ! 21: .PP ! 22: .B "unsigned long strtoul(nptr, rptr, base) ! 23: .B char *nptr, **rptr; ! 24: .fi ! 25: .SH DESCRIPTION ! 26: .IR Atof , ! 27: .IR atoi , ! 28: and ! 29: .I atol ! 30: convert a string pointed to by ! 31: .I nptr ! 32: to floating, integer, and long integer ! 33: representation respectively. ! 34: The first unrecognized character ends the string. ! 35: .PP ! 36: .I Atof ! 37: recognizes an optional string of tabs and spaces, ! 38: then an optional sign, then ! 39: a string of digits optionally containing a decimal ! 40: point, then an optional ! 41: .L e ! 42: or ! 43: .L E ! 44: followed ! 45: by an optionally signed integer. ! 46: .PP ! 47: .I Atoi ! 48: and ! 49: .I atol ! 50: recognize an optional string of tabs and spaces, ! 51: then an optional sign, then a string of ! 52: decimal digits. ! 53: .PP ! 54: .I Strtod, ! 55: .I strtol, ! 56: and ! 57: .I strtoul, ! 58: behave similarly to ! 59: .I atof, ! 60: and ! 61: .I atol ! 62: and, if ! 63: .I rptr ! 64: is not zero, set ! 65: .I *rptr ! 66: to point to the input character ! 67: immediately after the string converted. ! 68: .PP ! 69: .I Strtol ! 70: and ! 71: .I strtoul ! 72: interpret the digit string in the specified ! 73: .I base, ! 74: from 2 to 36, ! 75: each digit being less than the base. ! 76: Digits with value over 9 are represented by letters, ! 77: a-z or A-Z. ! 78: If ! 79: .I base ! 80: is 0, the input is interpreted as an integral constant in ! 81: the style of C (with no suffixed type indicators): ! 82: numbers are octal if they begin with ! 83: .LR 0 , ! 84: hexadecimal if they begin with ! 85: .L 0x ! 86: or ! 87: .LR 0X , ! 88: otherwise decimal. ! 89: .I Strtoul ! 90: does not recognize signs. ! 91: .SH SEE ALSO ! 92: .IR scanf (3) ! 93: .SH DIAGNOSTICS ! 94: Zero is returned if the begining of the input string is not ! 95: interpretable as a number. ! 96: .PP ! 97: If overflow is detected by ! 98: .I atof, ! 99: .I strtod, ! 100: .I strtol, ! 101: or ! 102: .I strtoul, ! 103: a maximum value of the correct sign is returned and ! 104: .I errno ! 105: is set to ! 106: .BR ERANGE . ! 107: .SH BUGS ! 108: .I Atoi ! 109: and ! 110: .I atol ! 111: have no provisions for overflow.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.