About .NET string to stringw

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
thomas1234
Posts: 14
Joined: Mon Jan 19, 2009 12:36 pm
Location: Hong Kong

About .NET string to stringw

Post by thomas1234 »

Hi, does anyone know how to convert the .NET string to stringw?

Code: Select all

String^ net_s = "Hello .NET"; //.Net string

stringw s=(stringw)net_s;
It gives me an error as following:
1>.\main.cpp(221) : error C2440: 'type cast' : cannot convert from 'System::String ^' to 'irr::core::stringw'
1> Conversion requires a constructor or user-defined-conversion operator, which can't be used by const_cast or reinterpret_cast

Thanks.
thomas1234
Posts: 14
Joined: Mon Jan 19, 2009 12:36 pm
Location: Hong Kong

Post by thomas1234 »

Anybody can give a hand? Thanks :cry:
cdrwolfe
Posts: 100
Joined: Thu Nov 15, 2007 5:38 pm
Location: Cranfield University

Post by cdrwolfe »

Out of curiosity are you using the .NET version of Irrlicht?

Regards Wolfe
thomas1234
Posts: 14
Joined: Mon Jan 19, 2009 12:36 pm
Location: Hong Kong

Post by thomas1234 »

cdrwolfe wrote:Out of curiosity are you using the .NET version of Irrlicht?

Regards Wolfe
Yes. I use it in my unmanged c++ program. But I need to pass something to the managed dll which is written in c#. So need to make this conversion.
Post Reply