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, string, intPtr)
16
17       int
18       Tcl_GetDouble(interp, string, doublePtr)
19
20       int
21       Tcl_GetBoolean(interp, string, boolPtr)
22

ARGUMENTS

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

DESCRIPTION

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

KEYWORDS

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