I usually use pointers as follows
char * ptr = malloc (sizeof (char) * 100);
memset (ptr, 0, 100);
strncpy (ptr, "cat", 100 - 1);
But this time, instead of using "cat", I want to use its ASCII equivalent in hexadecimal.
cat = 0x63,0x61,0x74,0x00
I tried
strncpy (ptr, "0x630x61", 100 - 1);
But he fails as expected.
What is the correct syntax?
Do I also need to put 0x00? For a moment, forget about memset , now I need to put 0x00? Because in the cat notation, zero is automatically placed.
Hi
source share