Charles.Forsyth20060303-partialeea662d19 years agoHistory
127 lines · 2.4 KB · Text
RawDownload
.TH ATOI 10.2.SH NAMEatoi, atol, charstod, strtod, strtol, strtoul, strtoll \- convert text to numbers.SH SYNOPSIS.nf.ta \w'\fLdouble 'u.Bint	atoi(char *nptr).PP.Blong	atol(char *nptr).PP.Bdouble	charstod(int (*f)(void *), void *a).PP.Bdouble	strtod(char *nptr, char **rptr).PP.Blong	strtol(char *nptr, char **rptr, int base).PP.Bulong	strtoul(char *nptr, char **rptr, int base).PP.Bvlong	strtoll(char *nptr, char **rptr, int base).fi.SH DESCRIPTION.IR Atoiand.I atolconvert a string pointed to by.I nptrto integer, and long integerrepresentation respectively.The first unrecognized character ends the string.Leading C escapes are understood, as in.I strtolwith.I basezero..PP.I Atoiand.I atolrecognize an optional string of tabs and spaces,then an optional sign, then a string ofdecimal digits..PP.IR Strtod ,.IR strtol ,.IR strtoul ,and.I strtollbehave similarly to .I atoland, if.I rptris not zero, set.I *rptrto point to the input characterimmediately after the string converted..PP.I Strtodrecognizes an optional string of tabs and spaces,then an optional sign, thena string of digits optionally containing a decimalpoint, then an optional .L eor .L Efollowedby an optionally signed integer..PP.IR Strtol ,.I strtouland.I strtollinterpret the digit string in the specified.IR base ,from 2 to 36,each digit being less than the base.Digits with value over 9 are represented by letters,a-z or A-Z.If.I baseis 0, the input is interpreted as an integral constant inthe style of C (with no suffixed type indicators):numbers are octal if they begin with.LR 0 ,hexadecimal if they begin with.L 0xor.LR 0X ,otherwise decimal..I Strtouldoes not recognize signs..PP.I Charstodinterprets floating point numbers in the same syntax as.IR strtod ,but it gets successive characters by calling.BR (*\fIf\fP)(\f2a\f5) .The last call to.I fterminates the scan, so it must have returned a character thatis not a legal continuation of a number.Therefore, it may be necessary to back up the input stream one characterafter calling.IR charstod ..SH SOURCE.B /libkern/atol.c.br.B /libkern/charstod.c.br.B /libkern/strtod.c.br.B /libkern/strtol.c.br.B /libkern/strtoul.c.br.B /libkern/utils.c.SH DIAGNOSTICSZero is returned if the beginning of the input string is notinterpretable as a number; even in this case,.I rptrwill be updated.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t