man 查找函数的头文件_MAN查看库函数语法和所在头文件 | 学步园

转载自:http://www.jishuziyuan.com/archive/sinekary/7925378.html

每次想查某个C库函数的文件时,总是上网搜,然后在博客里看到。有是还得看好几篇,才找到。

这不是办法呀,window有MSDN,linux有MAN,怎么不去用呢?

1. 查看man(manual)手册说明,看,man既是动词,又是名词,它还是形容词(他好man哦)

$ man man

The table below shows the section numbers of the manual followed by the types of pages they contain.

1   Executable programs or shell commands

2   System calls (functions provided by the kernel)

3   Library calls (functions within program libraries)

4   Special files (usually found in /dev)

5   File formats and conventions eg /etc/passwd

6   Games

7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)

8   System administration commands (usually only for root)

9   Kernel routines [Non standard]

可以看到,第3条是显示库函数的手册。

2. 查看printf头文件

$ man 3 printf

查看格式化说明符,可以搜索specifier

The conversion specifier

A character that specifies the type of conversion to be applied.  The conversion specifiers and their meanings are:

d, i   The  int  argument is converted to signed decimal notation.  The precision, if any, gives the minimum number of digits that must appear; if the converted value

requires fewer digits, it is padded on the left with zeros.  The default precision is 1.  When 0 is printed with an explicit precision 0, the output is empty.

o, u, x, X

The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation.  The letters  abcdef  are  used

for x conversions; the letters ABCDEF are used for X conversions.  The precision, if any, gives the minimum number of digits that must appear; if the converted

value requires fewer digits, it is padded on the left with zeros.  The default precision is 1.  When 0 is printed with an explicit precision 0, the  output  is

empty.

查看所在头文件,就在开头SYNOPSIS标题下

PRINTF(3)                                                                 Linux Programmer's Manual                                                                 PRINTF(3)

NAME

printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion

SYNOPSIS

#include

int printf(const char *format, ...);

int fprintf(FILE *stream, const char *format, ...);

如果直接:

$ man printf

则默认显示的是第1条:可执行程序或shell命令

1 Executable programs or shell commands

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值