Conversion of CHAR

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
ManTis
Posts: 12
Joined: Mon Sep 06, 2004 7:29 pm

Conversion of CHAR

Post by ManTis »

i have this error:

C:\Program Files\Microsoft Visual Studio\MyProjects\nanana\main.cpp(65) : error C2664: 'addTextSceneNode' : cannot convert parameter 2 from 'char [21]' to 'const unsigned short *'


How to convert char type variable to a irrlicht-usable string? the L"somethinghere" type?
ManTis
Posts: 12
Joined: Mon Sep 06, 2004 7:29 pm

Post by ManTis »

to make this question more clear -
i have this code:

char name[21];
std::cout << "What is your name?\n";
std::cin >> name;

i want to show 'name' in add TextSceneNode

______________________

update:
I've got it: i use MultiByteToWideChar :)
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

irr::core::stringc(name).c_str()

or something similar.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

bal means - irr::core::stringw(name).c_str()

;)

so -

Code: Select all

char name[21];
std::cout << "What is your name?" << endl;
std::cin >> name;
core::stringw wstr = name;
then use wstr.c_str ( ) as your argument to the text for your TextSceneNode.
Post Reply