【发布时间】:2014-08-27 07:02:35
【问题描述】:
我有一个字符串:
char *s = "asdf:jhgf";
我需要把它分成两个标记:
token[0] = "asdf";
token[1] = "jhgf";
我在使用 strtok() 时遇到问题。
【问题讨论】:
-
strtok not working.你试过什么? -
阅读
strchr。还是只使用循环? -
size of string not predefined可以通过strlen获取字符串长度。 -
如果你试图在字符串文字上做
strtok...不要这样做