TonyCooper
TonyCooper

Reputation: 23

Find values in char array c++

I have a char array and the text actually looks like XML:

<root>
<number>1</number>
<counter>2</counter>
<lastNumber>3</lastNumber>
</root>

I need to get these values and store them to variables so I can work with them.

Any idea how to do that?

Thank you

Upvotes: 1

Views: 234

Answers (2)

user1824407
user1824407

Reputation: 4559

You should formulate a better question, but the general idea is clear and so I suggest to use a library such as boost::spirit or, if you can arrange your data in a different way, you can use boost::config which is probably a much simpler approach and here is an example .

Upvotes: 2

barryjones
barryjones

Reputation: 2309

You could use TinyXML, to parse the file. http://www.grinninglizard.com/tinyxml/ Its a open source library to parse XML files in C++.

Upvotes: 6

Related Questions