我正在尝试解析这一行
Completion_Time_Stamp = 2013-04-04@12:10:22(Eastern Daylight Time)
并将名称放在一个变量中,将值放在另一个变量中
token[0] = strtok(buf, " = "); // first token
if (token[0]) // zero if line is blank
{
for (n = 1; n < 10; n++)
{
token[n] = strtok(0, " = "); // subsequent tokens
if (!token[n]) break; // no more tokens
}
}
输出 :
token[0] = Completion_Time_Stamp
token[1] = 2013-04-04@12:10:22(Eastern
token[2] = Daylight
token[3] = Time)
但我想要这样的东西:
token[0] = Completion_Time_Stamp
token[1] = 2013-04-04@12:10:22(Eastern Daylight Time)
我该如何做到这一点?多个分隔符??