#include <string.h>
char * strerror(int errnum);
/* 显示错误代码0 至9 的错误原因描述 */
#include <string.h>
main()
{
int i;
for(i = 0; i < 10; i++)
printf("%d : %s\n", i, strerror(i));
}
0 : Success 1 : Operation not permitted 2 : No such file or directory 3 : No such process 4 : Interrupted system call 5 : Input/output error 6 : Device not configured 7 : Argument list too long 8 : Exec format error 9 : Bad file descriptor
void perror(char *string);
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
int main( void )
{
FILE *fp;
fp = fopen( "test.txt", "w" );/*打开文件*/
assert( fp ); /*断言不为空*/
fclose( fp );/*关闭*/
fp = fopen( "nulltest.txt", "r" );/*打开一个不存在的文件*/
if ( NULL == fp )
{
/*显示最近一次错误信息*/
perror("fopen( \"nulltest.txt\", \"r\" )");
}
return 0;
}
fopen( "nulltest.txt", "r" ):No such file or directory
perror("1");
perror("2");
1:success 2:Illegal seek
#include <stdio.h>
int ferror(FILE *stream);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有