Error codes for C++ macros. More...
| int | get_errno() |
| void | set_errno(int e) |
| int | EDOM |
| int | ERANGE |
| int | EILSEQ |
| int | EINVAL |
| int | ENOENT |
| int | ENOMEM |
| int | EACCES |
| int | EEXIST |
| int | EIO |
| int | EBUSY |
| int | EAGAIN |
| int | EPIPE |
Error codes for C++ macros. Load with #include <errno.h> or #include <cerrno> (same plugin). Available from LayoutEditor 20260918.
On every C library, errno is a macro, not a variable you can assign. In a LayoutEditor macro you therefore cannot write errno = 0. Use the two functions below.
Many C functions store a small integer when they fail (file not found, invalid argument, …). That integer is the “errno value”. The named constants (ENOENT, EDOM, …) are those numbers so you can compare without memorizing codes.
#include <errno.h>
int main(){
set_errno(0);
if (get_errno() != 0) return 1;
set_errno(EDOM);
cout("EDOM = ", EDOM, " current = ", get_errno(), "\n");
set_errno(0);
}
The named constants (ENOENT, EDOM, …) are int values. Exact numbers can differ between operating systems; always compare by name, not by a hardcoded number. POSIX names exist only if the host C library defines them.
Reads the current error code stored by the C library.
Parameters: none.
Returns: int — 0 means “no error” (if you cleared it). Any other value is a code; compare it to the constants below.
Writes the error code. Call set_errno(0) before a sequence of calls if you want to know whether this call failed.
Parameters:
e (int) — new code. Use 0 to clear, or a constant such as EDOM.Returns: nothing.
Mathematics: argument outside the domain (for example square root of a negative number in some libraries).
Result too large or too small to be represented (overflow / underflow).
Illegal byte sequence (invalid encoding).
Invalid argument passed to a function.
No such file or directory.
Not enough memory.
Permission denied.
File already exists (for example creating a file that is already there).
Input/output error.
Resource busy (already in use).
Resource temporarily unavailable; try again later.
Broken pipe (writing to a closed pipe).
GNU-only extra names are not added by this plugin.
Python: import errno. This include is for C++ macros only.