我在哪里可以看到的是,并将errno交互功能列表? [英] Where can I see the list of functions that interact with errno?

查看:119
本文介绍了我在哪里可以看到的是,并将errno交互功能列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这本书C程序设计语言这样说的:

In the book "The C Programming Language" it says:

许多在图书馆设置状态指示功能,当发生错误或文件结束。这些
  指示器可被设置并明确测试。此外,整数前pression 错误号(声明
  在<&errno.h中GT; )可能包含一个错误编号,提供有关最更多信息
  最近的错误。

"Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly. In addition, the integer expression errno (declared in <errno.h>) may contain an error number that gives further information about the most recent error."

我在哪里可以看到这些功能的列表?

Where can I see a list of these functions?

推荐答案

标准说,这个约错误号

错误号的值是在程序启动时为零,但永远不会被任何库设置为零
  功能。 errno的值可以通过对库函数调用是否有错误,所提供的errno的使用是不是在函数在这个国际标准的说明文件设置为非零。

The value of errno is zero at program startup, but is never set to zero by any library function. The value of errno may be set to nonzero by a library function call whether or not there is an error, provided the use of errno is not documented in the description of the function in this International Standard.

这对我说,任何库函数可以耍着错误号以任何方式它喜欢以下情况除外:

Which says to me that any library function can screw around with errno in any way it likes except:


  • 不能置错误号 0

  • 它不能做它喜欢如果标准明确地说,否则

请注意,该标准建议在脚注如下:

Note that the standard suggests the following in a footnote:

因此​​,使用错误号错误检查库函数调用之前应该将其设置为零的程序,那么随后的库函数调用之前检查它。当然,库函数可以节省输入错误号的值,然后将其设置为零,只要原来的值将被恢复,如果错误号的价值只是返回之前仍为零。

Thus, a program that uses errno for error checking should set it to zero before a library function call, then inspect it before a subsequent library function call. Of course, a library function can save the value of errno on entry and then set it to zero, as long as the original value is restored if errno's value is still zero just before the return.

在其他的答案指出,这是常见的功能不在标准设置错误号以及

As noted in other answers, it's common for functions that are not in the standard to set errno as well.

这篇关于我在哪里可以看到的是,并将errno交互功能列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆