开发者

How to extract a subpart of char* [duplicate]

开发者 https://www.devze.com 2023-02-26 05:47 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Modify a char* string in C
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Modify a char* string in C

I have:

char* htmlstring = "htmldata"

How do I extract:

char* htmlstring1 = "htmldata 开发者_如何转开发before </body>tag"

char* htmlstring2 ="htmldata after and including</body> tag"

Can I use strstr? Whats the best approach?


strncpy(destination_string, source + start, count)

It's not really safe, but works. You should wrap it around.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号