Using string stored in variables...

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Go|iath
Posts: 12
Joined: Fri Dec 24, 2010 11:00 pm

Using string stored in variables...

Post 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 :/
Go|iath
Posts: 12
Joined: Fri Dec 24, 2010 11:00 pm

Post 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);
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

try this:

Code: Select all

irr::core::stringc name = "world.obj";
irr::scene::IAnimatedMesh* Mworld = sceneManager->getMesh(name.c_str());
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Go|iath
Posts: 12
Joined: Fri Dec 24, 2010 11:00 pm

Post by Go|iath »

Well, thanks a lot Acki.

It did the job :D

I wish you a very good day sir.
Post Reply