Use strncpy
e.g.
strncpy(dest, src + beginIndex, endIndex - beginIndex);
This assumes you’ve
- Validated that
destis large enough. endIndexis greater thanbeginIndexbeginIndexis less thanstrlen(src)endIndexis less thanstrlen(src)
Use strncpy
e.g.
strncpy(dest, src + beginIndex, endIndex - beginIndex);
This assumes you’ve
dest is large enough.endIndex is greater than beginIndexbeginIndex is less than strlen(src)endIndex is less than strlen(src)