Thanks for your quick response and help.

But what I was hoping to achieve is to send hex values through the sendTo functions (or any C function). The above code is just a sample/trial to test sending data. I am sorry I had not explained it better. I hope this time it is clearer.

Originally, I have some hex values in an array that I hope to transmit to an electronic device, which reads only hex values. But when SendTo function is used to send this array of hex values, it treats all the hex values in the array as string and then converts these to hex values. Now, when these converted hex values reach the device, all the data is wrong because they were not the original hex values that I had hoped to send.For example, if I send 'FF' as hex in SendTo, 'FF' is treated as string and its hexadecimal values '4646' are sent to the device,instead of the 'FF' hex value. So my device gets the wrong values and performs the wrong operations.

I was wondering if there is any way of making a socket program send hex values as hex values itself without any further conversion, i.e., hexadecimal 'FF' is sent as 'FF' itself and not '4646'.

I thought the above program was simpler and easier to relate to in my case, as primarily it is sending data across the ethernet using C on linux,i.e., the user-input message is converted as hex values to emulate my SendTo function which needs to send hex values too. Once again, sorry for not being clearer.

Any help would be much appreciated.