Hi,

I'm trying to read certain values from a text file and store them in a variable/string so that I can populate a combobox with the values. I have my read stream etc, but I'm unsure about how I would pick out certain data from the text file that I have. The data I want is all the CD id's such as cd232 and 342, the text files structure is below. I would really appreciate your help.

CD232
Bryan Adams
Greatest Hits
HMV
UK
CD
Reading Store
CD342
Bryan Adams
18 Til I die
HMV
UK
DVD
Oxford Store


Cheers

Recommended Answers

All 2 Replies

Does the text file contain delimiters other than CRLF ?
If not, then you will have to consider using line based parsing.
Line 0 = CDid
Line 1= Artist
Etc.

If you can post some code, someone (if not me) will come along and give you some feedback.

// Jerry

if you encompass your cd234 with [] you can find them easier,
then when reading information to populate whatever if the first char is "[" then it's the end of the list for cd234, and stop populating.

for example your new file structure could be:

[cd234]
some data
more data
little bit more
almost there
alright done
[cd235] --- hey time to stop. first char is "["

if you need more help, just say so...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.