I have a hexadecimal string that I want to convert to a regular string (to send as a tcp message).
I took every two digits (say 61), converted them to a long int (say my_int = 6*16 +1 = 97) and got the corresponding ascii character (in this case "a")
string1 points to the character string "a" whose ascii value is 97.Code://e.g. char* string1 = (char*) 97;
Now I want to concatinate string1 and string2, and store them in string2.Code:char* string1 = (char*) my_int; char* string2 = (char*) my_int2; char* string2 = malloc(1024);
But I get a segmentation fault, whether I use strcpy(), strcat(), or even a function that I write.
(PS: I am writing in C and I need the final string to be of type char*)