I am trying to convert a pid into a string. I tried it this way:
int pid = getpid(); //this int conversion should be ok as far as I know
char * mypid = (char *)malloc(sizeof(int));
sprintf(mypid, "%d", pid);
I assume that my mistake is maybe that I have not added a NULL in the end. I tried to do that but still got error messages. Can someone explain me what is the best way to but a PID into a char * ("string") ? Thanks!!