strText=0532 1234 4567 3456
rect.left = atoi((const char*) strText);
rect.top = atoi((const char*) strText + 5);
rect.right = atoi((const char*) strText + 10);
rect.bottom = atoi((const char*) strText + 15);最后的结果是
rect.left = 0532
rect.top = 1234
rect.right = 4567
rect.bottom = 3456
这是为什么呢?
rect.left = atoi((const char*) strText);
rect.top = atoi((const char*) strText + 5);
rect.right = atoi((const char*) strText + 10);
rect.bottom = atoi((const char*) strText + 15);最后的结果是
rect.left = 0532
rect.top = 1234
rect.right = 4567
rect.bottom = 3456
这是为什么呢?
#include <stdio.h>char *string = "a string,of ,,tokens";
char *token;void main(void)
{
token = strtok(string," ,"); /*There are two delimiters here*/
while (token != NULL){
printf("The token is: %s\n", token);
token = strtok(NULL," ,");
}
}
The output of this program is as follows:
The token is: a
The token is: string
The token is: of
The token is: tokens 参考这个,别用固定的长度。
strText是从 注册表 中读取的一些字符串。atoi一下,为什么就成那样了呢?