ntohl

my machine is little endian, and binary data that i need to convert is big endian. hence when i try to convert to text, it gives weird values.
does ntohl function in endian.h help??
where can i get endian.h from?

please someone help!!!!

If your binary data is integers ntohl() will help.

WHAT OS? endian.h is not standard for this see:
htons(), htonl(), ntohs(), ntohl()

no my binary data is float?? what to use???

no my binary data is float!
what to use then if not ntohl???

By float do you mean IEEE-754 (4 bytes)?

try something like this:

#include <stdlib.h>
#include <netinet/in.h>

float bin2flt(void *src)
{
	typedef union 
                {float flt; long lng; }
             flt_t;
	flt_t val;
	val.lng=ntohl( *(int*)src);
	return val.flt;
}

Float's a little more tricky. The binary representation may or may not be recognized by the receiving end, even after changing endianness. Your best bet is to convert to BCD of fixed length, or a string using sprintf and scanf.