Magnitude=Vector.getLength();
txtbox->setText(Magnitude); // ERROR!! Need to convert!
text is for use in a IGUIStaticText* txtbox.
I've seen a bunch of string conversion tutorials for strings and such but I can't seem to find the translation of double to const unsigned char*.
in C/C++ you can't convert from number to text without any functions between. But the function you need is very easy:
(you have to include stdio.h and wchar.h)
wchar_t string[32];
swprintf(string,32,"%f",Vector.getLength());
txtbox->setText(string);
BTW:
If you want to print a integer to a text you have to write %d instead of %f. If you want to know more about that function, just search for printf(), or sprintf() on google (the parameters of sprintf and swprintf are the same). It's a very usefull function, which can not only convert number to strings...
Looks like I'm getting closer but it still doesn't convert completely. It is getting converted to a character array successfully, but not all the way to 'const unsigned short *'
compiler error:
Main.cpp(64) : error C2664: '_snwprintf' : cannot convert parameter 3 from 'char [3]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast.