0
我在Arduino的這段代碼strcat的不沖水
void function(int x){
char* response="GET /postTEST.php?first=";
char strx[2] = {0};
int num = x;
sprintf(strx, "%d", num);
original=response;
strcat(response,strx);
Serial.println(response);
//memset(response,'\0',80);
}
基本上,這是加入到我的帖子字符串的整數。不幸的是,它不知怎麼成長,並且變成了 GET /postTEST.php?first=0 GET /postTEST.php?first=01 GET /postTEST.php?first=012 隨着我增加i。
怎麼回事?
是傳遞的整數一個數字?這就是你用'strx [2]'分配空間的全部內容。 – 2013-02-24 12:30:42