Thread: Editbox problem

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    23

    Question Editbox problem

    In my program it has an editbox which holds a 4 digit number and uses the registry to store it. but if i was to write "0123" in the editbox, but when i come back to it, it would be just "123". I don't want this, I would format it to have zeros in front of it. But is their another way?

    cal

  2. #2
    Registered User
    Join Date
    Nov 2004
    Posts
    4
    As you probably already know, standard c/c++ library ato* functions truncate zeros if they are in front of a whole-number string. To combat this, I would suggest reading/writing the string one character at a time before converting it to numerical (integer, float, double) type data.
    Or perhaps , writing the value as a string.

    hope this helps
    Last edited by rottinglich; 11-03-2004 at 04:13 PM.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Store the number as ascii instead of an integer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM