cin.getline help

This is a discussion on cin.getline help within the C Programming forums, part of the General Programming Boards category; I changed cin to cin.getline and when I try to Compile the code I get this. I'm using MinGW Developer ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    2

    cin.getline help

    I changed cin to cin.getline and when I try to Compile the code I get this.
    I'm using MinGW Developer Studio.
    Compiling source file(s)...
    File1.cxx
    File1.cxx: In function `int main()':
    File1.cxx:20: error: no matching function for call to `std::basic_istream<char, std::char_traits<char> >::getline(std::string&, int)'
    G:\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\ ..\..\..\..\include\c++\3.4.2\bits\istream.tcc:582 : note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::getline(_CharT*, std::streamsize, _CharT) [with _CharT = char, _Traits = std::char_traits<char>]
    G:\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\ ..\..\..\..\include\c++\3.4.2\istream:399: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::getline(_CharT*, std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>]
    Heres my cin.getline
    cin.getline(text1,256);

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    I like the C string class too.

    Anyways, uh, I guess on topic, you need to choose between the STL getline or the istream getline.

    http://msdn.microsoft.com/library/de...estlsample.asp
    http://www.cplusplus.com/ref/iostrea...m/getline.html

    Look at the examples/prototypes for the use. And this should probably be in the C++ section.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    2
    Quote Originally Posted by Tonto
    I like the C string class too.

    Anyways, uh, I guess on topic, you need to choose between the STL getline or the istream getline.

    http://msdn.microsoft.com/library/de...estlsample.asp
    http://www.cplusplus.com/ref/iostrea...m/getline.html

    Look at the examples/prototypes for the use. And this should probably be in the C++ section.
    Thanks very much I've got it fixed now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin.getline and msgrcv
    By osal in forum C++ Programming
    Replies: 2
    Last Post: 03-17-2005, 11:01 AM
  2. difference between getline and cin.getline
    By bartinla in forum C++ Programming
    Replies: 3
    Last Post: 11-13-2004, 08:47 AM
  3. cin.getline()
    By Ifurita. in forum C++ Programming
    Replies: 4
    Last Post: 05-29-2003, 01:14 PM
  4. problem with cin.getline()
    By Waldo2k2 in forum C++ Programming
    Replies: 8
    Last Post: 05-28-2002, 05:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21