Problem in Converting Unsigned long to String

Hi All,

I am facing the Problem while converting from unsigned long to string. can any body help me out?

The thing is i have an unsigned long. I have to convert that to string.

Consider,

unsigned long type=0x11;

The unsigned long will take 4 bytes. I want to convert this to string of 4 Bytes.

Again if I convert the string of 4 Bytes to unsigned long I have to get the origianal value.

i tried using sprintf(str, "%lu", sizeof(unsigned long));

When I tried to get the first four bytes and convert it back to unsigned long it is not giving the original value.

Can anybody help me out.. Please?

Thanks in Advance.

- Maddy.