Thread: How read *.csv file?

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    12

    How read *.csv file?

    Hello All:

    I used to read *.txt file, with one column, into C/C++ program ?

    Now from Yahoo downloading stock prices, they are in EXCEL *.csv format. How can read them into C/C++ program?

    --Zhao

  2. #2
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Read up to the comma for each column. Start over at the end of the line.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  3. #3
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Your excel .csv file 'may' have strings defined by " " surrounding them - this i think is the default when exporting- so you need to be aware of that when you search the lines of your .csv to obtain the field content
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 06-18-2012, 08:23 AM
  2. Open a file, read it ... and ... read it again
    By Tiago in forum C Programming
    Replies: 1
    Last Post: 04-17-2010, 03:32 AM
  3. File Handling -Read write and edit a file
    By aprop in forum C Programming
    Replies: 3
    Last Post: 02-27-2010, 02:01 PM
  4. How can I know the actual bytes read in a file read
    By pliang in forum C++ Programming
    Replies: 1
    Last Post: 06-08-2005, 04:23 PM