1Tcl_SetErrno(3) Tcl Library Procedures Tcl_SetErrno(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_SetErrno, Tcl_GetErrno, Tcl_ErrnoId, Tcl_ErrnoMsg - manipulate
9 errno 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
40 argument 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
46 directly.
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.
51 Tcl_ErrnoMsg returns a human-readable string such as "permission
52 denied" that corresponds to the value of its errorCode argument. The
53 errorCode argument is typically the value returned by Tcl_GetErrno.
54 The strings returned by these functions are statically allocated and
55 the caller must not free or modify them.
56
57
59 errno, error code, global variables
60
61
62
63Tcl 8.3 Tcl_SetErrno(3)