首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::gets

Defined in header <cstdio>

?

?

char* gets( char* str );

?

(until C++14)

stdin直到找到换行符或文件结束为止.

参数

str

-

character string to be written

返回值

str在成功的时候,NULL在失败的时候。

如果故障是由文件结束条件造成的,则另外设置EOF指标%28见std::feof()29%stdin如果故障是由其他错误引起的,则设置误差指标%28见std::ferror()29%stdin...

注记

该函数没有提供任何方法来防止目标数组的缓冲区溢出,只要输入字符串足够长。std::gets在C++11中被废弃,从C++14中删除。

std::fgets可以代替使用。

另见

scanffscanfsscanf

reads formatted input from stdin, a file stream or a buffer (function)

fgets

gets a character string from a file stream (function)

fputs

writes a character string to a file stream (function)

C.GET的文档

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com