打印

请C语言编程的人来看看

请C语言编程的人来看看

我以前是在windows下编程的,现在转到linux上来了
在windows下面,可以通过GetLastError()来得到错误,在linux下用什么来得到?

TOP

perror()
详情看 manpage
   

TOP

直接把问题当题目不就
OK了   搞这么多点击率。。。。。。。。。。。。。

TOP

你需要保存errorno这个变量的值,然后用各种函数把它转为描述性的字符串

TOP

fprintf(stderr,"there is an error: %s", strerror(errno));  

TOP

4楼,是errno

TOP