APUE1.7出错处理

时间:2015-01-29 21:04:21   收藏:0   阅读:160

技术分享

技术分享

技术分享

#include "apue.h"
#include <errno.h>

int main(int argc, char *argv[])
{
    fprintf(stderr, "EACCES: %s\n", strerror(EACCES));
    errno = ENOENT;
    perror(argv[0]);
    exit(0);
}
all: mycat hello testerror
mycat: ls1.c
	g++ -g -Wall ls1.c ../lib/libapue.a -I ../include -o ls1
hello: hello.c
	g++ -g -Wall hello.c -I ../include/ ../lib/libapue.a -o hello
testerror: testerror.c
	g++ -g -Wall testerror.c -I ../include/ ../lib/libapue.a -o testerror
clean:
	rm ls1 hello testerror

 

技术分享

 

 

 

技术分享

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!