Thread: Why I have to cin.ignore() ?

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.

  2. #17
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by Elysia View Post
    I think you're making mountans out of molehills right now.

    Prelude's articles tend to be complete. I don't think that means input is an insurmountable problem. A lot of detail goes into working with wide streams, and fixing other weirdness such as what happens if there is no input waiting in the stream when you ignore. These details are not relevant all of the time. I could plan my input so that such special cases never occur.

    Additionally, I would handle EOF all of the time, sure, but that's well defined in the standard.

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I merely pointed out that it's not always so "simple," to just put some cin.ignore() statements in well defined points in the code, as the article seems to indicate.
    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.

  4. #19
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Elysia View Post
    I merely pointed out that it's not always so "simple," to just put some cin.ignore() statements in well defined points in the code, as the article seems to indicate.
    That was initially my point anyway !

  5. #20
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    And you turned my simple correction into a debate. I didn't have any problem with what you said other than what I quoted. Fixing the stream state is easy, after which you'd call some version of ignore_line() from the article. After reading the article, of course.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin.ignore();
    By BlackSlash12 in forum C++ Programming
    Replies: 7
    Last Post: 08-24-2007, 02:20 PM
  2. cin.ignore() in C
    By swgh in forum C Programming
    Replies: 10
    Last Post: 08-09-2007, 10:45 PM
  3. Console window waiting on cin.ignore() or cin.ignore(2)
    By The SharK in forum C++ Programming
    Replies: 3
    Last Post: 07-19-2006, 04:17 PM
  4. ignore
    By indigo0086 in forum C++ Programming
    Replies: 1
    Last Post: 11-13-2002, 09:56 AM