Tcl_SetErrno(), Tcl_GetErrno(), Tcl_ErrnoId(), Tcl_ErrnoMsg()

manipulate errno to store and retrieve error codes 

Tcl Library Procedures


SYNOPSIS

#include <tcl.h>

void Tcl_SetErrno(errorCode)

int Tcl_GetErrno()

char * Tcl_ErrnoId()

char * Tcl_ErrnoMsg()

()


ARGUMENTS

int errorCode (in) 

A POSIX error code such as ENOENT.


DESCRIPTION

Tcl_SetErrno() and Tcl_GetErrno() provide portable access to the errno variable, which is used to record a POSIX error code after system calls and other operations such as Tcl_Gets(). These procedures are necessary because global variable accesses cannot be made across module boundaries on some platforms.

Tcl_SetErrno() sets the errno variable to the value of the errorCode argument C procedures that wish to return error information to their callers via errno should call Tcl_SetErrno() rather than setting errno directly.

Tcl_GetErrno() returns the current value of errno. Procedures wishing to access errno should call this procedure instead of accessing errno directly.

Tcl_ErrnoId() and Tcl_ErrnoMsg() return a string representation of the current errno value. Tcl_ErrnoId() returns a machine-readable textual identifier such as "EACCES". Tcl_ErrnoMsg() returns a human-readable string such as "permission denied". The strings returned by these functions are statically allocated and the caller must not free or modify them.


PORTABILITY

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


PTC MKS Toolkit 10.4 Documentation Build 39.