strerror

Gamma: Version 4.0
Prev |  | Next

# `strerror`

`strerror` -- retrieves an error message.

## Syntax

    strerror (errno)

## Arguments

`errno`

  The error number as returned by `errno`.

## Returns

An error message as a string.

## Description

This function looks up error messages associated with error numbers.

## Example

In this example, we first define a function to remove a file. Then we call that function on a non-existing file to generate an error. Finally, we check the returned error code to get the error message.

        function remove_file(file)
        {
           unlink(file);
           errno();
        }

        Gamma> ret_val = remove_file("/tmp/xyz");
        2
        Gamma> strerror(2);
        "No such file or directory"
        Gamma>

## See Also

`errno`

Prev | Home | Next
`sleep`, `usleep` | Up | `system`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.