Ok, nother prob, wchar_t to char array

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
killer7
Posts: 14
Joined: Fri Dec 10, 2004 2:42 am
Location: Chicago, USA

Ok, nother prob, wchar_t to char array

Post by killer7 »

i need to get the text out of my text box so i did:

Code: Select all

char Name[51];
Name = namebox->getText();
but it wont convert the unicode wchar_t to standered char :(

How do i do it.

P.S.
I find your forums VERY helpful and the people bery nice
Know modeling?

Got spare time?

Email me: moe@cgispy.com
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Try:

Code: Select all

Name = namebox->getText().c_str();
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
killer7
Posts: 14
Joined: Fri Dec 10, 2004 2:42 am
Location: Chicago, USA

Post by killer7 »

Here is the error it gave me with your new code:

main.cpp:141: request for member `c_str' in `
(*(namebox->irr::gui::IGUIElement::_vptr$IUnknown + 52))(namebox)', which is
of non-aggregate type `const wchar_t*'


This is first time dev-c++ ever thru an error i dont know what it means :(
Know modeling?

Got spare time?

Email me: moe@cgispy.com
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

You could do a couple different things here. The getText() function return the text from the box as a pointer to a wchar_t array. The irrlicht 'core::stringc' stirng class has an operator which will convert the wchar_t* array into the core::stringc format ( which is standard ascii style c string ).

For example -

Code: Select all

core::stringc str;
str = namebox->getText ( );
killer7
Posts: 14
Joined: Fri Dec 10, 2004 2:42 am
Location: Chicago, USA

Post by killer7 »

I love you :mrgreen:
Know modeling?

Got spare time?

Email me: moe@cgispy.com
Post Reply