endianess problem!!!!

This is a discussion on endianess problem!!!! within the Networking/Device Communication forums, part of the General Programming Boards category; I have a small doubt regarding endianess. My system here is little endian and the board I am communicating with ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    4

    endianess problem!!!!

    I have a small doubt regarding endianess. My system here is little endian and the board I am communicating with is big endian. Hence the data received by the board is not same as what I am sending. I have heard about htons and htonl,are they used only for IP address conversion or even for data? I just need to make sure that data should be matched both the sides,so can anybody please help me out!!!!Thanks in advance.......

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,243
    Quote Originally Posted by sandeepvignesh View Post
    I have a small doubt regarding endianess. My system here is little endian and the board I am communicating with is big endian. Hence the data received by the board is not same as what I am sending. I have heard about htons and htonl,are they used only for IP address conversion or even for data? I just need to make sure that data should be matched both the sides,so can anybody please help me out!!!!Thanks in advance.......
    Network byte order is big-endian, and you need to convert native-endian to/from big-endian, so the htonX() and ntohX() functions are exactly what you need.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    4
    Thanks a lot. I will let you know if at all i face any problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21