Sign in to follow this  

Checking if char array has been initalized...

This topic is 3936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am reading in text from an XML file via MSXML2::IXMLDOMNodePtr. I wish to parse all strings that are passed in so that things such as /n are replaced with the new line character. I think I have a parsing algorithmn that should work, however it crashes before it gets there because it gets called on nodes where the text field has not been initialized. How can I tell either from the members on IXMLDOMNode, or by looking at the char array it's self if it has been initialized? It fails because strlen gets an access violation error when it's called on the text field. the text will usually hold something like this: "îþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþ" Any Ideas?

Share this post


Link to post
Share on other sites
If you know the maximum length of the string you could possibly check for a terminator in the string. The other option would be to actually initialise the string at the start to be "".

These are just ideas and I dont know how MSXML2 works.

Cheers

Share this post


Link to post
Share on other sites

This topic is 3936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this