Search code examples
c++istream

Game programming in c++, what's this old line, and why doesn't it work?


Here's a line of code that I get an error about, which is in my book from 2008: std::cin.get(std::cin.rdbuff()->in_avail()+1);

Could someone please tell me what it means and why it gives me an error:

In function 'int main()':|7|error: 'struct std::istream' has no member named 'rdbuff'|
||=== Build finished: 1 errors, 0 warnings ===|

--update--

changed rdbuff to rdbuf, and it throws this error:

walkthrough.cpp|7|error: no matching function for call to 'std::basic_istream<char, std::char_traits<char> >::get(std::streamsize)'|

Solution

  • The member function is called rdbuf(), one f, as a cursory glance at any library reference will easily reveal.

    In other words, the error is that istream has no member named rdbuff.