Blame


1 78e51a8c 2005-01-14 devnull .TH FMTSTRTOD 3
2 78e51a8c 2005-01-14 devnull .SH NAME
3 78e51a8c 2005-01-14 devnull fmtstrtod, fmtcharstod \ - convert text to numbers
4 78e51a8c 2005-01-14 devnull .SH SYNOPSIS
5 78e51a8c 2005-01-14 devnull .B #include <utf.h>
6 78e51a8c 2005-01-14 devnull .br
7 78e51a8c 2005-01-14 devnull .B #include <fmt.h>
8 78e51a8c 2005-01-14 devnull .PP
9 78e51a8c 2005-01-14 devnull .PP
10 78e51a8c 2005-01-14 devnull .B
11 78e51a8c 2005-01-14 devnull double fmtstrtod(char *nptr, char **rptr)
12 78e51a8c 2005-01-14 devnull .PP
13 78e51a8c 2005-01-14 devnull .B
14 78e51a8c 2005-01-14 devnull double fmtcharstod(int (*f)(void *), void *a)
15 78e51a8c 2005-01-14 devnull .SH DESCRIPTION
16 78e51a8c 2005-01-14 devnull .I Fmtstrtod
17 78e51a8c 2005-01-14 devnull converts a string pointed to by
18 78e51a8c 2005-01-14 devnull .I nptr
19 78e51a8c 2005-01-14 devnull to floating point representation and, if
20 78e51a8c 2005-01-14 devnull .I rptr
21 78e51a8c 2005-01-14 devnull is not zero, sets
22 78e51a8c 2005-01-14 devnull .I *rptr
23 78e51a8c 2005-01-14 devnull to point to the input character immediately after the string converted.
24 78e51a8c 2005-01-14 devnull .I Fmtstrtod
25 78e51a8c 2005-01-14 devnull recognizes an optional string of tabs and spaces,
26 78e51a8c 2005-01-14 devnull then an optional sign, then a string of digits optionally
27 78e51a8c 2005-01-14 devnull containing a decimal point, then an optional
28 78e51a8c 2005-01-14 devnull .L e
29 78e51a8c 2005-01-14 devnull or
30 78e51a8c 2005-01-14 devnull .L E
31 78e51a8c 2005-01-14 devnull followed by an optionally signed integer.
32 78e51a8c 2005-01-14 devnull .PP
33 78e51a8c 2005-01-14 devnull .PP
34 78e51a8c 2005-01-14 devnull .I Fmtcharstod
35 78e51a8c 2005-01-14 devnull interprets floating point numbers in the manner of
36 78e51a8c 2005-01-14 devnull .IR atof ,
37 78e51a8c 2005-01-14 devnull but gets successive characters by calling
38 78e51a8c 2005-01-14 devnull .BR (*\fIf\fP)(a) .
39 78e51a8c 2005-01-14 devnull The last call to
40 78e51a8c 2005-01-14 devnull .I f
41 78e51a8c 2005-01-14 devnull terminates the scan, so it must have returned a character that
42 78e51a8c 2005-01-14 devnull is not a legal continuation of a number.
43 78e51a8c 2005-01-14 devnull Therefore, it may be necessary to back up the input stream one character
44 78e51a8c 2005-01-14 devnull after calling
45 78e51a8c 2005-01-14 devnull .IR fmtcharstod .
46 78e51a8c 2005-01-14 devnull .SH SOURCE
47 a3993885 2017-09-01 rsc .B https://9fans.github.io/plan9port/unix
48 78e51a8c 2005-01-14 devnull .SH SEE ALSO
49 78e51a8c 2005-01-14 devnull .IR fscanf (3)
50 78e51a8c 2005-01-14 devnull .SH DIAGNOSTICS
51 78e51a8c 2005-01-14 devnull Zero is returned if the beginning of the input string is not interpretable
52 78e51a8c 2005-01-14 devnull as a number; even in this case,
53 78e51a8c 2005-01-14 devnull .I rptr
54 78e51a8c 2005-01-14 devnull will be updated.