POSIX errors (The GNU Algol 68 Compiler)

### 8.4 POSIX errors ¶

When a call to a procedure in this prelude results in an error, the called procedure signals the error in some particular way and also sets a global `errno` to a code describing the error. For example, trying to opening a file that doesn’t exist will result in `fopen` returning -1, which signals an error. The caller can then inspect the global `errno` to see what particular error prevented the operation to be completed: in this case, `errno` will contain the error code corresponding to “file doesn’t exist”.

Procedure: errno `= int` ¶

  This procedure yields the current value of the global `errno`. The yielded value reflects the error status of the last executed POSIX prelude operation.

Procedure: strerror `= (int ecode) string` ¶

  This procedure gets an error code and yields a string containing an explanatory short description of the error. It is typical to pass the output of `errno` to this procedure.

Procedure: perror `= (string msg) void` ¶

  This procedure prints the given string `msg` in the standard error output, followed by a colon character, a space character and finally the string error of the current value of `errno`.