⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perror.c

📁 标准c库代码,可以应用于各个系统提供了大量的基本函数
💻 C
字号:
/*FUNCTION<<perror>>---print an error message on standard errorINDEX	perrorINDEX	_perror_rANSI_SYNOPSIS	#include <stdio.h>	void perror(char *<[prefix]>);	void _perror_r(void *<[reent]>, char *<[prefix]>);TRAD_SYNOPSIS	#include <stdio.h>	void perror(<[prefix]>)	char *<[prefix]>;	void _perror_r(<[reent]>, <[prefix]>)	char *<[reent]>;	char *<[prefix]>;DESCRIPTIONUse <<perror>> to print (on standard error) an error messagecorresponding to the current value of the global variable <<errno>>.Unless you use <<NULL>> as the value of the argument <[prefix]>, theerror message will begin with the string at <[prefix]>, followed by acolon and a space (<<: >>). The remainder of the error message is oneof the strings described for <<strerror>>.The alternate function <<_perror_r>> is a reentrant version.  Theextra argument <[reent]> is a pointer to a reentrancy structure.RETURNS<<perror>> returns no result.PORTABILITYANSI C requires <<perror>>, but the strings issued vary from oneimplementation to another.Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,<<lseek>>, <<read>>, <<sbrk>>, <<write>>.*/#include <stddef.h>#include <stdio.h>#include <string.h>void_DEFUN (_perror_r, (ptr, s),	struct _reent *ptr _AND	_CONST char *s){  char *error;  if (s != NULL && *s != '\0')    {      fputs (s, _stderr_r (ptr));      fputs (": ", _stderr_r (ptr));    }  if ((error = strerror (ptr->_errno)) != NULL)    fputs (error, _stderr_r (ptr));  fputc ('\n', _stderr_r (ptr));}#ifndef _REENT_ONLYvoid_DEFUN (perror, (s),	_CONST char *s){  _perror_r (_REENT, s);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -