在C语言中,“stdio”和“stdlib”代表什么意思?

3

是否有任何地方可以解释所有缩写库名称?我不需要关于这些库的文档,我只想知道这些标题是什么的缩写。它们是缩写吗?

4个回答

23

好的,那我们开始列一个列表:

  • "stdio": 标准输入输出
  • "stdlib": 标准库
  • "printf": 打印格式化内容
  • "fprintf": 文件打印格式化内容("打印格式化内容到文件")
  • "sprintf": 字符串打印格式化内容("打印格式化内容到字符串")
  • "vfprintf": 可变参数fprintf
  • "fputc": 文件中放置字符("将字符放入文件")
  • "scanf": 扫描格式化内容
  • "fread": 从文件中读取内容("从文件中读取")
  • "pthread": Posix线程
  • "uint16_t": 无符号整数类型,宽度为16位
  • "sigatomic_t": 一种可以在信号处理程序中原子访问的类型
  • 一般情况下的"_t": 用于标准库类型名称的后缀。
  • "float": 浮点数
  • "double": 双精度浮点数
  • "char": 字符
  • "bit": 二进制数字
  • "fd": 文件描述符
  • "fcntl.h": 文件控制(Posix文件描述符)
  • "ioctl.h": I/O控制(也是Posix)
  • "stat": 文件状态(也是Posix)
  • "lstat": 状态,可能是链接本身的状态
  • "fstat": 文件描述符的状态
  • "sleep": 中断正常活动,以支持完全无活动
  • "usleep": 上述版本,使用微秒(µs)作为参数,'u'看起来有点像'µ',而基本上是ASCII
  • "recv": 接收
  • "creat": 创建
  • "str": 字符串,在C中通常指以null结尾的字符数组
  • "strtok": 分解字符串
  • "pow": 幂
  • "frexp": 小数部分(有效数字)和指数
  • "abs": 绝对值
  • "malloc": 内存分配
  • "calloc": 分配并明确初始状态为零
  • "wcsrtombs": 宽字符字符串到多字节字符串的转换,可重入
  • "wctomb": 宽字符转换为多字节字符
  • "iconv": ???
  • "uconv": "iconv"的ICU版本

7
usleep中的u不是命令式的。它代表微秒(micro)的希腊字母μ(即µ),因为该函数参数是以微秒为单位的。 - R.. GitHub STOP HELPING ICE
1
没有标准的约定,@FrederickCraine;你所询问的任何对象的约定都是由其发起者在70年代或80年代选择的。最好的方法就是给你特定名称的派生。 - Jonathan Leffler
2
calloc 并没有明确(检查)初始状态是否为零,它会主动将位模式设置为零。请注意,usleep 让我有点发笑,但不幸的是,答案的某些部分是错误的,无法获得赞同 :-) - paxdiablo
1
frexp 是用于获取一个数的 小数 部分和 指数 部分。而我认为 calloc 更像是 _清空分配_。 - sarnold
谢谢大家。现在我可以先查看这个列表了!我很惊讶居然还没有关于这些的维基百科…… - Marty
显示剩余12条评论

12

标准输入/输出(I/O)和标准库


而你是怎么知道的?我知道谷歌可以,但如果没有谷歌呢?有没有命名文档之类的东西? - Marty
4
@Frederick: "std" 是“标准”的非常普遍的缩写。 - Ben Voigt
那个有解释,但其他的(fcntl.h)没有。 - Marty
@Dietrich,我在哪里可以找到它? - Marty
1
找到 man 手册?如果您使用的是类 Unix 系统,它们可能已经安装好了,您只需运行 man fcntl 即可。如果这样不起作用,请安装 man 手册。 - Dietrich Epp
显示剩余2条评论

10

您想知道如何自己查找这些内容。(我喜欢Kerrek SB的列表,但是我不怪您想知道如何自己查找这些内容。)

首先:如果您使用Debian或Ubuntu,请强烈建议您安装manpages-posixmanpages-posix-dev软件包,除了通常的manpages软件包外。这将使您可以访问标准以及Linux man-pages项目

通过以下命令可以立即看到区别:

man 2 close       # gives you the Linux documentation of the system call
man 3posix close  # gives you the POSIX definition of the function

对于不太可能是系统调用的函数,您也可以看到它们之间的差异:

man 3 qsort       # Linux man-pages project describing the glibc function
man 3posix qsort  # POSIX standard definition of the function, should be useful
                    description for any POSIX-compliant system

我还建议安装 dict, dictd, 以及 dict-jargondict-foldoc(或者两者都安装)软件包:

$ dict stdin
2 definitions found

From The Free On-line Dictionary of Computing (26 July 2010) [foldoc]:

  standard input/output
  standard I/O
  stderr
  stdin
  stdio
  stdout

     <programming, operating system> The predefined input/output
     channels which every {Unix} process is initialised with.
     Standard input is by default from the terminal, and standard
     output and standard error are to the terminal.  Each of these
     channels (controlled via a {file descriptor} 0, 1, or 2 -
     stdin, stdout, stderr) can be redirected to a file, another
     device or a {pipe} connecting its process to another process.
     The process is normally unaware of such {I/O redirection},
     thus simplifying prototyping of combinations of commands.

     The {C} programming language library includes routines to
     perform basic operations on standard I/O.  Examples are
     "printf", allowing text to be sent to standard output, and
     "scanf", allowing the program to read from standard input.

     (1996-06-07)


From V.E.R.A. -- Virtual Entity of Relevant Acronyms (June 2006) [vera]:

  STDIN
         STandarD INput

$ dict stdlib
No definitions found for "stdlib"
$ 

(很滑稽,对吧?没有你想要的其中之一。但是它们仍然是非常好用的工具。)


$ dict stdin -- 只是一个打字错误吗?也许是程序员的玩笑,差了一个字符?;-) - Wolf

5

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接