Hi,
i have an array of hex values
unsigned char buffer[]=
{ff,ff,0f,02,4b........};
//as ff contains 255 and ffff =65535 and
so on..
// char * temppointer=buffer;
i want to create a struct
typedef struct abc{
u_int32_t a;
u_int16_t b;
u_int64_t c;
u_int32_t d;
char buf[10];
};
u_int32_t convertoBigEndian :(u_int32_t
tmpint)
{
(u_int64_t)(((u_int64_t)(x) &
(u_int64_t)0x00000000000000ffULL) << 56) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0x000000000000ff00ULL) << 40) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0x0000000000ff0000ULL) << 24) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0x00000000ff000000ULL) << 8) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0x000000ff00000000ULL) >> 8) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0x0000ff0000000000ULL) >> 24) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0x00ff000000000000ULL) >> 40) | \
(u_int64_t)(((u_int64_t)(x)
& (u_int64_t)0xff00000000000000ULL) >> 56) )}
i want create a pointer to buffer[] array
and want to pass this pointer to structure abc and want
to read these values like first 4 bytes to
a, next 2 bytes to b and so on in little endian and big endian format.
I did this in C# but no idea in MAC so
please help me...
Waqar Ahmad