cin.getline is giving an error

Hello everyone,

I'm trying to use cin.getlnine function to acquire a string that i've p#include
ereviously declared. The program doesn't compile, it's generating this error:

C:\test\rt\main.cpp|10|error: no matching function for call to `std::basic_istream<char, std::char_traits<char> >::getline(std::string&)'|
What is 'p#include' supposed to mean?
I googled the error message, and found that this means the function is not declared, that means <iostream> not included.
well of course it is included, i tried using getline(cin,string) and it worked just fine, but i do not know why it gave me the error when i used it in the previous syntax...
try to post the code
closed account (jwC5fSEw)
cin.getline() and getline(cin,string) are two different things. cin.getline() is for character arrays (C-strings), whereas getline(cin,string) is for the string class.
Topic archived. No new replies allowed.