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
    Registered User
    Join Date
    Sep 2001
    Posts
    20

    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
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    use sprintf or better still the windows unicode safe version wsprintf() to format the float as a string..... This works just like printf except instead of sending formatted data to the screen it writes it to an array.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

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