Edit Boxes Question

This is a discussion on Edit Boxes Question within the Windows Programming forums, part of the Platform Specific Boards category; I'm writing a program that output some values. Some of them are integers and others are doubles. I'm using the ...

  1. #1
    Ruben
    Guest

    Question Edit Boxes Question

    I'm writing a program that output some values. Some of them are integers and others are doubles. I'm using the following function for the integer values:

    char string[100];

    int number=20;

    _itoa( number, string, 10 );

    SetDlgItemText(hWnd,IDC_OUT,string);

    If I want to output a double (i.e. double number=2.55) the above function does not put the decimals.

    Is there another function for doubles and floats?

    Thanks,
    Ruben

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    72
    use wsprintf() or sprintf() to format the output to the char array.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    sprintf would be my choice as you can format the text better than _atoi.

    _atof will convert a float like _atoi.

    There is also SetDlgItemInt. As far as I know there is no SetDlgItemFloat ect.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Edit box question
    By learning110 in forum Windows Programming
    Replies: 6
    Last Post: 03-28-2003, 07:16 PM
  2. Edit Boxes
    By ColdFire in forum Windows Programming
    Replies: 2
    Last Post: 02-13-2002, 01:54 PM
  3. please help visual c++ edit control boxes
    By alcoholic in forum C++ Programming
    Replies: 3
    Last Post: 02-05-2002, 01:39 PM
  4. edit boxes
    By face_master in forum Windows Programming
    Replies: 2
    Last Post: 01-25-2002, 04:47 PM
  5. Password Edit Boxes
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 08-27-2001, 02:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21