1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need urgent help!!!!

Discussion in 'C' started by Vipul Bajaj, Nov 7, 2006.

  1. Vipul Bajaj

    Vipul Bajaj New Member

    Joined:
    Nov 3, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to implement conversion from little endian to big endian on data from a file. the data is such that first 4 bytes give the size of the data adjacent to it. Then I have to convert both the size and the data from little endian to big endian. Then again 4 bytes of size and then data and so on. How to convert the data?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    For Size it should be same in little as well as big endian.

    For data just reverse each chunk of the data.
     
  3. Aztec

    Aztec New Member

    Joined:
    May 9, 2006
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    0
    Use ntohl( ) and htonl( )
     

Share This Page