Thread: getline

  1. #1
    Unregistered
    Guest

    getline

    which library is "getline" in?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    It's in iostream.

    From console:
    char line[80];
    cin.getline(line,80);

    From a file:
    char line[80];
    char filename = "file.txt";
    ifstream in(filename);
    in.getline(line,80);

  3. #3
    Unregistered
    Guest
    ty

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Actually I should have said:

    The first example (for console i/o) uses <iostream>.
    The second example (for file i/o) uses <fstream>.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  2. getline problem
    By Bitphire in forum C++ Programming
    Replies: 5
    Last Post: 10-18-2004, 04:42 PM
  3. getline help
    By ProjectsProject in forum C++ Programming
    Replies: 3
    Last Post: 06-14-2004, 11:12 AM
  4. getline not working right
    By talz13 in forum C++ Programming
    Replies: 11
    Last Post: 12-10-2003, 11:46 PM
  5. getline with string class in Borland C++
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-08-2003, 02:59 PM