How do I ignore values from an input file

This is a discussion on How do I ignore values from an input file within the C++ Programming forums, part of the General Programming Boards category; I am trying to ignore values from an input file. I used the command cin.ignore() nut when I go to ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    4

    How do I ignore values from an input file

    I am trying to ignore values from an input file. I used the command

    cin.ignore()

    nut when I go to try the program I have to keep pushing enter and the message shows up one letter at a time, and it still isn't ignoring the value.

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Try replacing "cin" with the name of your ifstream object, eg:
    Code:
    std::ifstream in("myfile.txt");
    in.ignore();//ignore first char...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. disposing error
    By dropper166 in forum C# Programming
    Replies: 2
    Last Post: 03-30-2009, 11:53 PM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. fscanf in different functions for the same file
    By bchan90 in forum C Programming
    Replies: 5
    Last Post: 12-03-2008, 08:31 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM

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