[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


perror

Output an error message to stderr.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <stdio.h>
void perror(const char *s);
Parameters:

Parameters for this facility are:

s  
const char *  
Prints an errno and message  

Remarks:

If s is not NULL or a pointer to a null string the perror() function outputs to stderr the character array pointed to by s followed by a colon and a space ': '. Then, the error message that would be returned by strerror() for the current value of the global variable errno.

See Also:

"abort"

"errno"

Example of perror() usage.:
#include <errno.h>
#include <stdio.h>

int main()
{
	perror("No error reported as");
	errno = EDOM;
	perror("Domain error reported as");
	errno = ERANGE;
	perror("Range error reported as");
	
	return 0;
}

Output
No error reported as: No Error
Domain error reported as: Domain Error
Range error reported as: Range Error


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000