Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    void perror( const char *prefix );
    void _wperror( const wchar_t *prefix );

Description:
    The perror function prints, on the file designated by  stderr, the error
    message corresponding to the error number contained in  errno.  The
    perror function writes first the string pointed to by prefix to stderr.
    This is followed by a colon (":"), a space, the string returned by
    strerror(errno), and a newline character.

    The _wperror function is identical to perror except that it accepts a
    wide-character string argument and produces wide-character output.

Returns:
    The perror function returns no value.  Because perror uses the  fprintf
    function,  errno can be set when an error is detected during the
    execution of that function.

Example:
    #include <stdio.h>

    void main()
      {
        FILE *fp;

        fp = fopen( "data.fil", "r" );
        if( fp == NULL ) {
            perror( "Unable to open file" );
        }
      }

Classification:
    perror is ANSI, _wperror is not ANSI

Systems:
     perror - All, Netware

    _wperror - All

See Also:
    clearerr, feof, ferror, strerror

See Also: clearerr feof

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson