Results 1 to 5 of 5

Thread: Formatting Numbers in Strings

  1. #1
    hartless
    Guest

    Question Formatting Numbers in Strings

    I'm using sprintf to print numeric & string data into a buffer.
    The code i've used is sprintf(szBuf,"Size : %d bytes",&fsize)

    So far so good.

    How can i set up the number to be formatted to show seperators ie
    What i want to display : Size : 1,128,654 bytes
    What i'm able to do with sprintf : Size : 1128654 bytes

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I recall seeing something on MSDN that would take a file size in bytes, and then print it out, as in File->Properties.

    I couldn't find it again though - will keep looking
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    hartless
    Guest
    Thanks you very much, just what i needed.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    No problem.

    BTW - this is the function that Explorer uses
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width