Input
I wrote this function:
1 2 3 4 5 6 7 8
|
void Input(char* string, int n)
{
int i(0);
do {
cin >> *(string + i);
i++;
} while(cin.get(*(string + i)) != '\n');
}
|
It is supposed to do the same as cin.getline. However, the compiler complains:
|
58 C:\x.cpp no match for 'operator!=' in '(&std::cin)->std::basic_istream<_CharT, _Traits>::get [with _CharT = char, _Traits = std::char_traits<char>](((char&)(string + (+((unsigned int)i))))) != '\n''
|
Any ideas?
cin.get(int)
returns cin,
cin.get()
returns the integer (a promoted character)
Topic archived. No new replies allowed.