一、linux下高级应用编程--stdio.h

本文详细介绍了stdio.h头文件中的宏定义及其含义,并重点解释了fflush函数的作用及使用方法。了解这些内容有助于掌握C语言标准输入输出的基本操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

stdio.h 标准函数输入/输出

<stdio.h>头文件中用一些整数定义下列一些宏:

BUFSIZ:<stdio.h>中缓冲区的大小 _IOFBF:输入/输出全缓冲. _IOLBF:输入/输出行缓冲.当向缓冲区输入一个换行符时,缓冲区的内容会被flush。 _IONBF:输入/输出不缓冲. L_ctermid
[CX] [Option Start]Maximum size of character array to hold ctermid() output. [Option End]
L_tmpnam
Maximum size of character array to hold tmpnam() output.
SEEK_CUR
Seek relative to current position.
SEEK_END
Seek relative to end-of-file.
SEEK_SET
Seek relative to start-of-file.

The following macros shall be defined as positive integer constant expressions which denote implementation limits:

{FILENAME_MAX}
Maximum size in bytes of the longest filename string that the implementation guarantees can be opened.
{FOPEN_MAX}
Number of streams which the implementation guarantees can be open simultaneously. The value is at least eight.
{TMP_MAX}
Minimum number of unique filenames generated by tmpnam(). Maximum number of timesan application can call tmpnam() reliably. The value of {TMP_MAX} is at least 25. [XSI] [Option Start] On XSI-conformant systems, the value of {TMP_MAX} is at least 10000. [Option End]

The following macro name shall be defined as a negative integer constant expression:

EOF
End-of-file return value.

The following macro name shall be defined as a null pointer constant:

NULL
Null pointer.

The following macro name shall be defined as a string constant:

P_tmpdir
[XSI] [Option Start]Default directory prefix for tempnam(). [Option End]

定义函数:int fflush(FILE *stream)

函数说明:fflush()会强迫将缓冲区内的数据写回参数stream指定的文件中。如果参数stream为NULL, fflush()会将所有打开的文件数据更新。
返回值   :成功则返回0,  失败返回EOF, 错误代码存于errno中

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值