0

Im using WIN32 API. I want to take an integer lets suppose 1000 as input through an edit box. I am Using sendmessage() function for taking input but it can take only string input. How can I take an integer as input?

Ayse
  • 2,676
  • 10
  • 36
  • 61
  • 2
    Fetch the string, attempt to convert it to an integer. (The ES_NUMBER style may be applied to the control to allow only numeric input (still returned as a string, not guaranteed to be numeric (eg paste))) – Alex K. Mar 15 '13 at 11:42
  • You should read this [convert string to integer sscanf or atoi](http://stackoverflow.com/questions/3420629/convert-string-to-integer-sscanf-or-atoi) – David Heffernan Mar 15 '13 at 13:04

1 Answers1

1

You need to convert the string inputted in edit box to an integer like this e.g.:

int n = atoi(myString);
Leo Chapiro
  • 13,678
  • 8
  • 61
  • 92
  • You may also know the answer to my [Other Question](http://stackoverflow.com/questions/15430935/display-an-integer-using-messagebox-function-in-c/15430989?noredirect=1#15430989) as well. Please have a look! – Ayse Mar 15 '13 at 12:05
  • @duDE it is remiss of you to mention `atoi` without describing all its flaws. – David Heffernan Mar 15 '13 at 13:04
  • What are the flaws of atoi ? :( – Ayse Mar 18 '13 at 05:03