fgets gets fputs puts

                                          fgets gets fputs puts

 

fgets

调用方式

char *fgets( char *string, int n, FILE *stream )

功能

Get a string from a stream.

返回值

Each of these functions returns string. NULL is returned to indicate an error or an end-of-file condition. Use feof or ferror to determine whether an error occurred.

注意

The fgets function reads a string from the input stream argument and stores it in string. fgets reads characters from the current stream position to and including the first newline character, to the end of the stream, or until the number of characters read is equal to n – 1, whichever comes first. The result stored in string is appended with a null character. The newline character, if read, is included in the string.

fgets is similar to the gets function; however, gets replaces the newline character with NULL.

 

gets

调用方式

char *gets( char *buffer )

功能

Get a line from the stdin stream.

返回值

Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.

注意

The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('/n'). gets then replaces the newline character with a null character ('/0') before returning the line. In contrast, the fgets function retains the newline character.

 

fputs

调用方式

int fputs( const char *string, FILE *stream )

功能

Write a string to a stream.

返回值

Each of these functions returns a nonnegative value if it is successful. On an error, fputs returns EOF.

注意

The function copies string to the output stream at the current position. The terminating null character the string is not copied.

 

puts

调用方式

int puts( const char *string );

功能

Write a string to stdout.

返回值

Each of these returns a nonnegative value if successful. If puts fails it returns EOF.

注意

The puts function writes string to the standard output stream stdout, replacing the string’s terminating null character ('/0') with a newline character ('/n') in the output stream.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值