我正在使用哪个getline?

时间:2019-04-04 19:36:47

标签: c++ qt-creator

对于C ++使用哪个getline()函数,我有些困惑。 小代码:

std::string name;
std::cout << "What is your name? ";
std::getline(std::cin, name); 

我很难在字符串标头中使用std :: getline,但是当我在getline()函数上单击鼠标时,IDE会将我重定向到stdio.h,这是一个C标头。

在执行时间中有一种方法可以知道我正在使用哪个函数?

Ps:是的,我要包含字符串标题(如果我不提出他的建议,因为我可以从使用它的任何地方都将其删除,并且仍然可以使用,但这又是一个问题)。

编辑: qt-creator将我重定向到stdio.h中的此函数

/* Like `getdelim', but reads up to a newline.

   This function is not part of POSIX and therefore no official
   cancellation point.  But due to similarity with an POSIX interface
   or due to the implementation it is a cancellation point and
   therefore not marked with __THROW.  */
extern _IO_ssize_t getline (char **__restrict __lineptr,
                size_t *__restrict __n,
                FILE *__restrict __stream) __wur;

这更奇怪,因为我正在使用2个参数,这里需要3个参数...

0 个答案:

没有答案