www.delorie.com/djgpp/doc/libc/libc_615.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

perror

Syntax

 
#include <stdio.h>

void perror(const char *string);

Description

This function formats an error message and prints it to stderr. The message is the string, a colon and a blank, and a message suitable for the error condition indicated by errno. If string is a null pointer or points to a null string, the colon and blank are not printed.

Return Value

None.

Portability

ANSI/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001

Example

 
int x = open("foo", O_RDONLY);
if (x < 0)
{
  perror("foo");
  exit(1);
}


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004