Advertisement Jump to content
Sign in to follow this  

Retreiving edit box info?

This topic is 4671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I was wondering how to get the information from an edit box. I know how to get it as an array of chars, but not as a float (which is what I need). Thanks in advance!

Share this post

Link to post
Share on other sites
If you can retrieve an array of characters, you can convert this into a float (using atof, or stringstreams).

One way is (assuming you're using C++):



float floatValue(HWND editbox){
unsigned int length = Edit_GetTextLength(editbox);
char* str = 0;
float value;
str = new char[length + 1];
Edit_GetText(editbox, str, length)
value = atof(str);
delete str;
throw; //Re-throw exceptions etc while not leaking memory
delete str;
return value;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!