help with getline.

This is a discussion on help with getline. within the C Programming forums, part of the General Programming Boards category; Could someone explain the proper usage of getline? I am trying to use it, but i do not understand it's ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    28

    help with getline.

    Could someone explain the proper usage of getline? I am trying to use it, but i do not understand it's formatting.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,621
    Getline is for C++. You are sure you are programming for C++ and not C?
    Getline reads a line from the file stream and stores it into a std::string buffer.
    Code:
    std::string str;
    getline(cin, str); // To read one line from the command prompt
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    28
    well, that makes sense then. I'm trying to use something from the wrong language...

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, 10:46 PM
  5. getline with string class in Borland C++
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-08-2003, 01:59 PM

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