August 18th, 2003, 02:55 PM
Need Help with Hexadecimal in C.
Can any one tell me how I can pad a string with hexadecimal values in C. I am new to this area. A string str1 should look like this:
[hexadecimal 2]str1[hexadecimal 3]. This is done just to make sure that str1 can contain any value and when i am reading it i will know that it starts with hexadecimal 4 and ends with hexadecimal 3.
August 18th, 2003, 02:59 PM
But your method of making sure it can contain any value does not work, what if they want a 3 in there of their own?
August 18th, 2003, 03:44 PM
I am not able to get this work....I would appriciate if u can give sample stmts of how to convert say "int i".
August 18th, 2003, 06:13 PM
How to convert it to what? Please be more specific about what you want. Are you wanting to embed arbitrary byte-values into your string using hexadecimal notation (which xtor showed you how to do)? Do you want to embed the value of a byte variable (unsigned char) into a string? Do you want to insert the ASCII representation of a hex value into a string? What is it that you want?