我需要根据字符的位置将字符串拆分为字符串。以便:
str1 = "hello?world" 是 str1 = "hello" 和 str2 = "world"
这是我到目前为止所拥有的:
char str1[100] = "hello?world";
char str2[100];
char *p;
p = strpbrk(str1, "?");
strcpy(&str2, p);
strcspn(str1, '?');
尝试将“p”之后的字符复制到 str2 时出现错误。必须有一种更好和更实用的方法。有人可以帮我吗?非常感谢...