I have a function that will parse some data coming in. My problem is that after using strncpy I get some garbage when I try to print it. I try using malloc to make the char
One problem: What if there's no newline?
Undefined behaviour:
pos = strchr(temp_str, newline); strcpy(temp_str, pos+1);
The source and destination of strcpy must not overlap.
strcpy