1Tcl_GetInt(3)               Tcl Library Procedures               Tcl_GetInt(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_GetInt,  Tcl_GetDouble,  Tcl_GetBoolean  -  convert  from string to
9       integer, double, or boolean
10

SYNOPSIS

12       #include <tcl.h>
13
14       int
15       Tcl_GetInt(interp, src, intPtr)
16
17       int
18       Tcl_GetDouble(interp, src, doublePtr)
19
20       int
21       Tcl_GetBoolean(interp, src, boolPtr)
22

ARGUMENTS

24       Tcl_Interp *interp (in)             Interpreter  to   use   for   error
25                                           reporting.
26
27       const char *src (in)                Textual value to be converted.
28
29       int *intPtr (out)                   Points  to  place  to store integer
30                                           value converted from src.
31
32       double *doublePtr (out)             Points to place  to  store  double-
33                                           precision floating-point value con‐
34                                           verted from src.
35
36       int *boolPtr (out)                  Points to place  to  store  boolean
37                                           value (0 or 1) converted from src.
38_________________________________________________________________
39
40

DESCRIPTION

42       These  procedures  convert from strings to integers or double-precision
43       floating-point values or booleans (represented as 0- or 1-valued  inte‐
44       gers).   Each of the procedures takes a src argument, converts it to an
45       internal form of a particular type, and stores the converted  value  at
46       the  location indicated by the procedure's third argument.  If all goes
47       well, each of the procedures returns TCL_OK.  If src does not have  the
48       proper syntax for the desired type then TCL_ERROR is returned, an error
49       message is left in the interpreter's result, and nothing is  stored  at
50       *intPtr or *doublePtr or *boolPtr.
51
52       Tcl_GetInt  expects  src  to consist of a collection of integer digits,
53       optionally signed and optionally preceded by white space.  If the first
54       two  characters of src after the optional white space and sign are “0x”
55       then src is expected to be in  hexadecimal  form;   otherwise,  if  the
56       first  such  character is “0” then src is expected to be in octal form;
57       otherwise, src is expected to be in decimal form.
58
59       Tcl_GetDouble expects src to consist of a floating-point number,  which
60       is:   white  space;  a sign; a sequence of digits;  a decimal point;  a
61       sequence of digits;  the letter “e”; a signed  decimal  exponent;   and
62       more  white  space.   Any of the fields may be omitted, except that the
63       digits either before or after the decimal point must be present and  if
64       the “e” is present then it must be followed by the exponent number.
65
66       Tcl_GetBoolean  expects  src to specify a boolean value.  If src is any
67       of 0, false, no, or off, then Tcl_GetBoolean stores  a  zero  value  at
68       *boolPtr.   If  src  is any of 1, true, yes, or on, then 1 is stored at
69       *boolPtr.  Any of these  values  may  be  abbreviated,  and  upper-case
70       spellings are also acceptable.
71
72

KEYWORDS

74       boolean, conversion, double, floating-point, integer
75
76
77
78Tcl                                                              Tcl_GetInt(3)
Impressum