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的文档
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

