Thread: cin.ignore

  1. #1
    Honderman
    Guest

    Smile cin.ignore

    Can anyone tell me what cin.ignore does?

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    If your question is this generic, ask google.

    http://www.google.com/search?q=cin.i...utf-8&oe=utf-8
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    if you didnt find the answer

    it ignores characters in a file up until a certain condition is met

    istream& ignore(streamsize num=1, int_type delim=EOF);
    is the basic prototype so the following calls are valid:

    x.ignore();
    (ignores a single character unless it is EOF)

    x.ignore(1000);
    (ignores 1000 characters unless it encounters EOF)

    x.ignore(10,'*');
    (ignores 10 characters unless it encounters an asterik (*) first)

    I have found that this can be useful for finding the first [ in a file for ini editing classes and such. Also if you use a special character to signify something in a text file you can easily skip over useless text and go straight to your data.

    (btw if you ever need to know a certain function prototype i have tons of books and help files laying around so you could just email me [email protected])

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin.ignore()
    By valthyx in forum C++ Programming
    Replies: 2
    Last Post: 07-22-2008, 04:23 AM
  2. 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
  3. Can't seem to come to conclusion : cin.ignore()
    By SkyHi in forum C++ Programming
    Replies: 8
    Last Post: 05-13-2005, 08:57 PM
  4. Why do we use cin.ignore()
    By himanch in forum C++ Programming
    Replies: 2
    Last Post: 02-04-2005, 01:52 PM
  5. need help with cin.get, or cin.ignore
    By yoyo in forum C++ Programming
    Replies: 5
    Last Post: 09-23-2003, 01:14 AM