C++: Trouble Using String as Argument of a Function -


OK, I have a problem in the following section of the code (in the header file):

 

#ifndef XML_H_INCLUDED #define XML_H_INCLUDED #include "libxml / parser.h" #include "libxml / xmlwriter.h" #includes & lt; String & gt; Class XmlFile {Public: XmlFile (string filename) {file = xmlParseFile (filename); } XmlDocPtr file; // pointer to XML file}; #endif // XML_H_INCLUDED

The file is included in the main source file (but it does not have access, so its content is not important).

I get the following error (in the notation):

  Error: 'std :: string' from logic '1' for 'const char *' 'xmlDoc * xmlParseFile (Const char *) 'can not be changed.  

I have participated in it many times, and this is driving me crazy.

I probably would not want to use vectors (adds another step to start the function.

What am I doing? I have tried to see it, but not me No satisfactory answer.

Thanks in advance.

  file = XmlParseFile (Filename.c_str ());  

Comments