CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Dec 2010
    Posts
    907

    Converting a little endian number into long

    Code:
    long x_size = buff2[3] << 24 | buff2[2] << 4 | buff2[1] >> 4 | buff2[0] >> 24;
    The original value: 6630836
    The value stored in file: b4 2d 65 00

    I read the number as
    Code:
    char *buff2[5] = { 0 };
    f.read(buff2, sizeof(char)*4);
    The result is ffffffff (-1)

    Are there any compact ways I can convert the number into the right form?
    I guess I am not doing it right for the moment....
    Thanks
    Jack
    Last edited by lucky6969b; May 6th, 2011 at 03:45 AM.

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

Featured