How to cut part of a string in c?

后端 未结 6 1829
面向向阳花
面向向阳花 2021-02-14 19:22

I\'m trying to figure out how to cut part of a string in C. For example you have this character string \"The dog died because a car hit him while it was crossing the road\" how

6条回答
  •  情深已故
    2021-02-14 20:01

    strncpy will only copy up to n characters. Optionally you can move a pointer around in the string, and also stick a \0 into the array to terminate it early if you have writable memory.

提交回复
热议问题