error: invalid conversion from ‘char’ to ‘const char*’

Hello, This code produces a compile error: invalid conversion from ‘char’ to ‘const char*’

The error is produced by the line indicated below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// This function loads a pinball table from an XML file.
bool LoadPinballTable(b2World &physics_world, std::vector<GameEntity*> &entity_list){
    using namespace rapidxml;

    std::string input_xml;
    std::string line;
    std::ifstream in("testtable.xml");

    // read file into input_xml
    while(getline(in,line)){
        std::cout << line << std::endl;
        input_xml += line;
    }

    // Run the RapidXML parser inputting the string that has just been loaded.
    std::vector<char> xml_copy(input_xml.begin(), input_xml.end());
    xml_copy.push_back('\0');
    xml_document<> doc;
    doc.parse<parse_full>(&xml_copy[0]);
    xml_node<> *node = doc.first_node(0);

    // Iterate over the DOM tree
    while (node != 0){
        std::cout << "Name of node is: " << *node->name()<< "\n";

        // If we encounter a staticwall tag, start making a static wall (strcmp(char[],string) instead of char[] == string)
        if ((strcmp((*node->name()), "staticwall") == 0)) // <<<--- Compile error here{

// More code after this... 


Why?
Last edited on
node->name() probably is a C-string already, so dereferencing it gives you a char. strcmp() doesn't accept char's as parameters.
That seems to fix it!

(mumbles something about wasting hours because of a little *)
Topic archived. No new replies allowed.