Forum Moderators: phranque

Message Too Old, No Replies

How To parse a Comma Delimited File using Visual C++

         

Marty

5:15 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



Such As:
aa,bb,22,ss,65,
bb,cc,33,tt,56,
etc. etc.
Entering each line into an array
Thanks for Your Help

oilman

5:57 pm on Jun 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Marty - welcome to WebmasterWorld.

I did a quick google search and came across this idea [experts-exchange.com]. Hope it helps.

aspdaddy

6:08 pm on Jun 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately c++ doenst have a split function, its a real pain.

One way is to replace them with spaces first and then use a the filestream >> operator to parse a word at a time.

If you search google groups for "c++ split function" there are other ideas how to write your own split.

Glacai

6:49 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



Hi Marty,

Sorry only straight C here, but what about just reading in each character at a time using getc, fread or something and entering them into an array until comma is matched and then start a new array.