Thread: Skipping Columns in Text File

  1. #1
    Registered User
    Join Date
    Aug 2008
    Location
    California
    Posts
    10

    Skipping Columns in Text File

    I've searched the web for ways to ignore data in specific colums of a text file. I found a way or two but they didn't seem to make much sense to me. So my question is, what would be the best way to ignore data from specific colums in a text file?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    What's wrong with reading line by line and then parsing out what you want?

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    the "right" solution for this depends very much on what your data looks like in the first place. For example, scanf() can be used with the "*" option, e.g "%*d" will "skip" a number in the input. But your data may not be numbers, and it may not be in a format that is easily understood using scanf(). MacGyver's solution is definitely an option.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Aug 2008
    Location
    California
    Posts
    10
    I guess the easiest way to do this was using the ignore after reading what I wanted to keep from the file. I tried it this way and it worked.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  4. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM