C file search

This is a discussion on C file search within the C Programming forums, part of the General Programming Boards category; I have a file with 13 columns of data and 10000 rows. The first column is identical for each row. ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    21

    C file search

    I have a file with 13 columns of data and 10000 rows. The first column is identical for each row. The second row is the date. I need to read this file and extract the data for a specific date into a separate file. Each date has approximately 500 records.

    What is the best way of doing this? What method should I use to search the first occurrence of the date and then read all the records for that date into a different file?

    Any suggestions please...

    Thanks

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    So read in a row, parsing it into columns (if it's nicely formatted, fscanf will work for you). If the second column is the date you want, write it out. If not, don't.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04:39 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 08:01 PM

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