Page 1 of 1

Using string stored in variables...

Posted: Thu Jan 13, 2011 10:29 pm
by Go|iath
Hi,

I am using the following code and everything work fine :



#include <string>
irr::scene::IAnimatedMesh* Mworld = sceneManager->getMesh("world.obj");





...unfortunately, I need to store the string "world.obj" in a variable. So I use something like...

#include <string>
std::string name = "world.obj";
irr::scene::IAnimatedMesh* Mworld = sceneManager->getMesh(&name);



and I get an error within the string class itself...

...something such as...

Code: Select all

irrString.h|282|error: could not convert '*(p ++)' to 'bool'|


Can anyone help me solving my problem please ?
I turned it in every directions yet I couldn't find the solution :/

Posted: Thu Jan 13, 2011 10:42 pm
by Go|iath
I tried this...
the same error happenned...

#include <string>
irr::core::stringw name = L"world.obj";
irr::scene::IAnimatedMesh* Mworld = sceneManager->getMesh(&name);

Posted: Thu Jan 13, 2011 11:55 pm
by Acki
try this:

Code: Select all

irr::core::stringc name = "world.obj";
irr::scene::IAnimatedMesh* Mworld = sceneManager->getMesh(name.c_str());

Posted: Fri Jan 14, 2011 12:39 am
by Go|iath
Well, thanks a lot Acki.

It did the job :D

I wish you a very good day sir.