Skipping Columns in Text File

This is a discussion on Skipping Columns in Text File within the C++ Programming forums, part of the General Programming Boards category; I've searched the web for ways to ignore data in specific colums of a text file. I found a way ...

  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,211
    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, 04:53 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01:36 PM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 11: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

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