设为首页 加入收藏

TOP

gets和puts函数
2014-11-23 21:38:04 来源: 作者: 【 】 浏览:9
Tags:gets puts 函数
char *gets( char *str );
The gets() function reads characters from STDIN and loads them into str, until a newline or EOF is reached. The newline character is translated into a null termination. The return value of gets() is the read-in string, or NULL if there is an error.
gets函数从标准输入设备读取字符串,直到遇到换行或者EOF。换行符被认为是终止字符。若函数调用成功,返回字符串;否则返回NULL。
int puts( char *str );
The function puts() writes str to STDOUT. puts() returns non-negative on success, or EOF on failure.
puts函数项标准输出设备写出字符串。若成功调用,返回非负值;否则EOF。
注意:这两个函数都是 c语言标准输入输出库中的函数,在使用时要包含;在c++中应包括。同时这两个函数的参数都是字符数组,而不能用c++中的字符串对象。
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇c语言 数组的更好运用 经典冒泡排.. 下一篇类/对象/属性/方法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: