1Tcl_SetErrno(3) Tcl Library Procedures Tcl_SetErrno(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_SetErrno, Tcl_GetErrno, Tcl_ErrnoId, Tcl_ErrnoMsg - manipulate er‐
9 rno to store and retrieve error codes
10
12 #include <tcl.h>
13
14 void
15 Tcl_SetErrno(errorCode)
16
17 int
18 Tcl_GetErrno()
19
20 const char *
21 Tcl_ErrnoId()
22
23 const char *
24 Tcl_ErrnoMsg(errorCode)
25
26
28 int errorCode (in) A POSIX error code such as ENOENT.
29______________________________________________________________________________
30
31
33 Tcl_SetErrno and Tcl_GetErrno provide portable access to the errno
34 variable, which is used to record a POSIX error code after system calls
35 and other operations such as Tcl_Gets. These procedures are necessary
36 because global variable accesses cannot be made across module bound‐
37 aries on some platforms.
38
39 Tcl_SetErrno sets the errno variable to the value of the errorCode ar‐
40 gument C procedures that wish to return error information to their
41 callers via errno should call Tcl_SetErrno rather than setting errno
42 directly.
43
44 Tcl_GetErrno returns the current value of errno. Procedures wishing to
45 access errno should call this procedure instead of accessing errno di‐
46 rectly.
47
48 Tcl_ErrnoId and Tcl_ErrnoMsg return string representations of errno
49 values. Tcl_ErrnoId returns a machine-readable textual identifier such
50 as “EACCES” that corresponds to the current value of errno. Tcl_Er‐
51 rnoMsg returns a human-readable string such as “permission denied” that
52 corresponds to the value of its errorCode argument. The errorCode ar‐
53 gument is typically the value returned by Tcl_GetErrno. The strings
54 returned by these functions are statically allocated and the caller
55 must not free or modify them.
56
57
59 errno, error code, global variables
60
61
62
63Tcl 8.3 Tcl_SetErrno(3)