Reputation: 29886
I have a number of xmlChar * in my source file and I need them to be in integer form.
How does one cast these correctly?
When I tried this world->representation = malloc(sizeof(int *) * mapHeight);
it says
error: invalid operands to binary * (have ‘long unsigned int’ and ‘xmlChar *’)
and when I tried this
world->representation = malloc(sizeof(int *) * (int) mapHeight);
I got this error
Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o "_commandfetcher", referenced from: _commandFetcher in ccPv5Pvd.o ld: symbol(s) not found for architecture x86_64
How can I cast a xmlChar pointer to an int? e.g the xmlChar has the value of 30, I need this in int form.
Upvotes: 1
Views: 1254
Reputation: 53310
You don't want to cast the pointer - you want to dereference it.
But in this case you probably want to convert the string into an integer?
Upvotes: 0