Problems with a string
Posted: Sun Jan 25, 2004 3:24 am
Hi.
A few days ago I downloaded Irrlicht and successfully compiled it in VC 6.0 While I am still discovering Irrlicht in general, I have already begun to program a 3D game editor with Irrlicht, a tool that would save me resources and time, and basically beats the need to compile everything all the time. Sadly I mostly work on PERL projects (CGI, etc) elsewhere, and my C++ skills are not as sharp as they should be.
Allright, here goes the question. I have this piece of code:
----------------------------------
wchar_t svdScreenMessage[1024];
char abc[1024] = "TEXT MESSAGE 5";
// Some other stuff ...
swprintf(svdScreenMessage, 1024, L"%s", abc);
guienv->addStaticText(svdScreenMessage, true, rect<int>(10,50,200,70));
---------------------------
All right. Basically what I am trying to do here is to copy the abc string (declared with char) into svdScreenMessage (declared with wchar_t as provided by IrrLicht). It turns out that it actualy compiles, with no errors. However, when I run the program,instead of seeing "TEXT MESSAGE 5" I just see some odd symbols like |||||
The only reason I want to do this is because I wanted to create a dinamic text box that would inform me of things during the game, and thus I wanted to use functions such as strcpy and strcat, etc, which wchar_t wont accept.
Is there any way to copy a normal string declared with char to a string declared with wchar_t ????
Thanks.
-IrrLicht Newbie
A few days ago I downloaded Irrlicht and successfully compiled it in VC 6.0 While I am still discovering Irrlicht in general, I have already begun to program a 3D game editor with Irrlicht, a tool that would save me resources and time, and basically beats the need to compile everything all the time. Sadly I mostly work on PERL projects (CGI, etc) elsewhere, and my C++ skills are not as sharp as they should be.
Allright, here goes the question. I have this piece of code:
----------------------------------
wchar_t svdScreenMessage[1024];
char abc[1024] = "TEXT MESSAGE 5";
// Some other stuff ...
swprintf(svdScreenMessage, 1024, L"%s", abc);
guienv->addStaticText(svdScreenMessage, true, rect<int>(10,50,200,70));
---------------------------
All right. Basically what I am trying to do here is to copy the abc string (declared with char) into svdScreenMessage (declared with wchar_t as provided by IrrLicht). It turns out that it actualy compiles, with no errors. However, when I run the program,instead of seeing "TEXT MESSAGE 5" I just see some odd symbols like |||||
The only reason I want to do this is because I wanted to create a dinamic text box that would inform me of things during the game, and thus I wanted to use functions such as strcpy and strcat, etc, which wchar_t wont accept.
Is there any way to copy a normal string declared with char to a string declared with wchar_t ????
Thanks.
-IrrLicht Newbie