【发布时间】:2016-05-05 06:40:06
【问题描述】:
我正在尝试将 char 字符串解析为 INT。
如果我有……
unsigned char color[] = "255"
并想将其解析为 INT。我该怎么做呢?
我试过了……
unsigned char *split;
split = strtok(color," ,.-");
while(split != NULL)
{
split = strok(NULL, " ,.-);
}
这只是给我现在拆分的值 255。
我觉得我需要类似...
int y = split - '0'; //but this makes an INT pointer without a cast
【问题讨论】: