求助:有关gets()

来源:百度知道 编辑:UC知道 时间:2024/06/01 01:29:30
有了这个函数执行顺序到底怎样
很奇怪
比如在他之前有条cout
先执行gets,在执行cout
如果cout里有'\n',还是这个顺序
如果不是'\n',而是endl;则先执行cout语句
我被搞糊涂了,到底有什么规则
如果说和编译器有关能不能再解释得更清楚点
谢谢

不知道你说的什么意思,我把gets的用法给你贴出来吧!

gets, _getws
Get a line from the stdin stream.

char *gets( char *buffer );

wchar_t *_getws( wchar_t *buffer );

Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

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.

Parameter

buffer

Storage location for input string

Remarks

The gets func