converter from byte to kilobyte
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 37

Thread: converter from byte to kilobyte

  1. #1
    Join Date
    Feb 2005
    Posts
    568

    converter from byte to kilobyte

    Is there have any function that allowed to convert byte to kilobyte??

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: converter from byte to kilobyte

    1 KB = 1024 B
    1 MB = 1024 KB
    1 GB = 1024 MB
    etc.

    Do you need anything more?
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Feb 2005
    Posts
    568

    Re: converter from byte to kilobyte

    Quote Originally Posted by cilu
    1 KB = 1024 B
    1 MB = 1024 KB
    1 GB = 1024 MB
    etc.

    Do you need anything more?
    i knew abt this... i means do there have any function that have any function that can convert directly?

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: converter from byte to kilobyte

    There is something: StrFormatByteSize64 and StrFormatByteSize.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,056

    Re: converter from byte to kilobyte

    Quote Originally Posted by lsy
    i knew abt this... i means do there have any function that have any function that can convert directly?
    What's wrong with division?

  6. #6
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: converter from byte to kilobyte

    Quote Originally Posted by GCDEF
    What's wrong with division?
    Division is BAD - "A house divided can not stand"

    So use multiplication by 0.0009765625.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  7. #7
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: converter from byte to kilobyte

    Quote Originally Posted by TheCPUWizard
    Division is BAD - "A house divided can not stand"

    So use multiplication by 0.0009765625.
    LOL. Multiplication is several times faster.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  8. #8
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: converter from byte to kilobyte

    Quote Originally Posted by cilu
    LOL. Multiplication is several times faster.
    Historically true, and historically significant.

    However it has been at lease a decade where I have seen a real world case of this being significant.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  9. #9
    Join Date
    Feb 2005
    Posts
    568

    Re: converter from byte to kilobyte

    Quote Originally Posted by cilu
    There is something: StrFormatByteSize64 and StrFormatByteSize.
    i try but it showing undeclared identifier... do you have any sample??

  10. #10
    Join Date
    May 2007
    Posts
    437

    Re: converter from byte to kilobyte

    included header file shlwapi.h in code
    ashu
    always use code tag

  11. #11
    Join Date
    Feb 2005
    Posts
    568

    Re: converter from byte to kilobyte

    Quote Originally Posted by ashukasama
    included header file shlwapi.h in code
    Include already but error still appear

  12. #12
    Join Date
    May 2007
    Posts
    437

    Re: converter from byte to kilobyte

    able to open this file "shlwapi.h"

    also whats error "will you post"
    Last edited by ashukasama; July 25th, 2007 at 12:12 AM.
    ashu
    always use code tag

  13. #13
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: converter from byte to kilobyte

    Sample? The use is so simple.

    I never actually used the function, and though MSDN says for minimum operating system "Windows 2000, Windows NT 4.0 with Internet Explorer 5, Windows 98, Windows 95 with Internet Explorer 5", I believe it is also supported on Win XP.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  14. #14
    Join Date
    Feb 2005
    Posts
    568

    Re: converter from byte to kilobyte

    Quote Originally Posted by ashukasama
    able to open this file "shlwapi.h"

    also whats error "will you post"
    how i check the file is open??
    before and after include shlwapi.h the error is same..."undeclared identifier"

  15. #15
    Join Date
    May 2007
    Posts
    437

    Re: converter from byte to kilobyte

    Quote Originally Posted by lsy
    how i check the file is open??
    before and after include shlwapi.h the error is same..."undeclared identifier"
    right click on file

    #include "shlwapi.h"

    on context menu you will find Open Document "shlwapi.h"
    try to open it ,
    if not found then search file in your computer
    Attached Images Attached Images  
    ashu
    always use code tag

Page 1 of 3 123 LastLast

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center