May 05, 2024, 11:16:48 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Readin text files

Started by maurice1, May 19, 2007, 07:43:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

maurice1

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 ?


Maurice

LarryMc

Attached is a modified version of your source.  Hope it does what you want.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

maurice1

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...
Maurice

LarryMc

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.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

maurice1

 :)

Thanks for the info. Larry
Maurice