How to parse integer from wide char string?
Re: How to parse integer from wide char string?
STL has some function in <string> like stoi or others in <cwchar> like wcstoll. Irrlicht has no tool function for wchar_t I think - so you'd have to convert to char first.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: How to parse integer from wide char string?
After a little of bit experimentation I concluded that I have different kind of problem. I need access the string from editBox in EventReceiver , but it seems that it cause segfault.
Here's the my code:
Here's the my code:
Code: Select all
gui::IGUIElement* startMenu = event.GUIEvent.Caller->getParent();
gui::IGUIEditBox* widthEdit = (gui::IGUIEditBox*) startMenu->getElementFromId(-2);
gui::IGUIEditBox* heightEdit = (gui::IGUIEditBox*) startMenu->getElementFromId(-3);
wprintf(widthEdit->getText());
startMenu->setVisible(false);
Re: How to parse integer from wide char string?
Sorry, not enough information. Check the pointers. Make sure the ID's are correct. Is that element really a IGUIEditBox?
You can also see all that in the debugger, just set a breakpoint and step through (if you ware not familiar with a debugger yet, take the chance to learn it, it's simply to use and you'll need it all the time when programming).
You can also see all that in the debugger, just set a breakpoint and step through (if you ware not familiar with a debugger yet, take the chance to learn it, it's simply to use and you'll need it all the time when programming).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm