IonicWind Software

IWBasic => GUI Central => Topic started by: maurice1 on May 19, 2007, 07:43:14 PM

Title: Readin text files
Post by: maurice1 on May 19, 2007, 07:43:14 PM
Ok I admit defeat ............

How do i read this text file data (sample shown below)?


[Title],Name, Hex Triplet, RGB, HSV
[group],A
Alice Blue, #F0F8FF, 240, 248, 245, 208ÂÃ,°, 6%, 100,
Alizarin Crimson, #E32636, 227, 38, 54, 355, 83, 89,
Amaranth, #E52B50, 229, 43, 80, 345, 78, 64,
Amber, #FFBF00, 255, 191, 0, 45, 100, 100,
Amethyst, #9966CC, 153, 102, 204, 270, 50, 80,
Apricot, #FBCEB1, 251, 206, 177, 30, 25, 87,
Aqua, #00FFFF, 0, 255, 255, 180, 100, 100,
Aquamarine, #7FFFD4, 127, 255, 212, 160, 50, 100,
Asparagus, #7BA05B, 123, 160, 91, 92, 43, 63,
Azure, #007FFF, 0, 127, 255, 210, 100, 100,


My code can't read "#" characters and spaces. I want to skip lines with nothing in them and those starting with [Title], [Comments], [Group]

Is there a simpler way to read data from a file separated by a comma eg data1, data2, data3, etc ?


Title: Re: Readin text files
Post by: LarryMc on May 19, 2007, 09:42:19 PM
Attached is a modified version of your source.  Hope it does what you want.

Larry
Title: Re: Readin text files
Post by: maurice1 on May 20, 2007, 01:52:08 AM
Quote from: Larry McCaughn on May 19, 2007, 09:42:19 PM
Attached is a modified version of your source.  Hope it does what you want.

Larry

It certainly does - thanks Larry. I assume there is no built in function to read data this way?

Now to put it in the main code...
Title: Re: Readin text files
Post by: LarryMc on May 20, 2007, 07:46:03 AM
You can use the ODBC database functions to read comma delimited files but with what you're doing I would think that what I gave you is the simpler approach.
Title: Re: Readin text files
Post by: maurice1 on May 20, 2007, 09:21:39 PM
 :)

Thanks for the info. Larry