Strcpy

A C standard library function: `strcpy` is used to copy non-overlapping, null-terminated strings

Strlen

A standard C function that returns the length of a string.



Byte returns use

Example

"Since is a string use strlen;by the way you could also use strcpy which is more suitable for strings"

from question  

How to memcpy() from argv[]?

"If strcpy is anything like strcpy it will write one byte more than strlen returns to zero terminate the string"

from question  

Heap corruption while freeing memory

Others

Example

With memset you have also to call strlen for get the length and add one;with strcpy is not required

from question  

How can I assign a string to a char* pointer?

Strcpy incoming connected will overwrite dataa and maybe datab if your first token pointed to by header is shorter than strlen connected

from question  

The strcpy function causing unwanted vars being modified

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0