Thread: Byte to MegaByte

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    57

    Byte to MegaByte

    Hello people!
    See that code:

    Code:
    if (total_lenght / 1024 >= 1024){total_lenght = total_lenght / 1024; tudo2 += "	Tamanho Total: " + FloatToString(total_lenght) + " MegaBytes.\n";}
    else if (total_lenght >= 1024){total_lenght = total_lenght / 1024; tudo2 += "	Tamanho Total: " + FloatToString(total_lenght) + " KiloBytes.\n";}
    else tudo2 += "	Tamanho Total: " + FloatToString(total_lenght) + " Bytes.\n";
    Well, it actually gives me the wrong number of MegaBytes =/
    What is wrong?
    Thanks =]

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    57
    Pff... was a idiot error in the first line, i forgot to divide by 1024 two times. Sorry =/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Need some help regarding data structures
    By Afrinux in forum C Programming
    Replies: 15
    Last Post: 01-28-2006, 05:19 AM
  4. error: identifier "byte" is undefined.
    By Hulag in forum C++ Programming
    Replies: 4
    Last Post: 12-10-2003, 05:46 PM
  5. sorting a structure of arrays
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 03-15-2002, 11:45 AM