Here is what I've tried:
Code: Select all
core::stringw GetCommand = EditBox->getText();
if(GetCommand==L"hide node"){
q3node->setVisible(false);
}
Code: Select all
core::stringw GetCommand = EditBox->getText();
if(GetCommand==L"hide node"){
q3node->setVisible(false);
}
Code: Select all
if(GetCommand==L"hide node")
Code: Select all
if (GetCommand.c_str() == L"hide node")
{
// Bleh
}
No, that would compare pointers which is usually not intended. Convert the constant string to a stringw object and you can use the comparison.Conquistador wrote:Or:
Code: Select all
if (GetCommand.c_str() == L"hide node") { // Bleh }
Code: Select all
int result = wcscmp( CommandText=EditBox->getText(), const wchar_t *Command1=L"hide node");
if(result=0){
q3node->setVisible(false);
}
//where result=0 means that strings are the same
If you're using pointer to something you shoudl not use "==" but some function which knows how to handle such pointers (e.g. your wcscmp which should work...). But you can also convert the constant string ("hide node") to a stringw object and then compare by usingdawasw wrote:Hybrid I am not sure what do you mean. Hmm could you point me more of your idea ?
Code: Select all
GetCommand==NewObject
should bedawasw wrote:wcscmp( const wchar_t *string1, const wchar_t *string2)
I have tried above using:
Code: Select all
if(result=0)
Code: Select all
if(result == 0)
Code: Select all
core::stringw GetCommand = EditBox->getText();
if(wcscmp(GetCommand.c_str(), L"hide node") == 0){
q3node->setVisible(false);
}
Huh? It works for me. Did you #include <wchar.h> ?dawasw wrote: Still doesn't work.
I use dev-cpp and irrlicht 0.12 .
Code: Select all
const wchar_t *text = L"hide node";
core::stringw GetCommand = EditBox->getText();
// don't forget to use a capital 'S' with printf for wchar_t strings
printf("Command = [%S], comparing to: [%S]\n", GetCommand.c_str(), text);
if(wcscmp(GetCommand.c_str(), text) == 0)
{
printf("%s\n", "Strings are equal");
q3node->setVisible(false);
}
else
{
printf("%s\n", "Strings are not equal");
}