|
芯片:LPC1765 开发环境:keil4的 V4.03 嵌入式系统:ucosii-2.52
有问题的代码段如下:
const char temp2[3]={'%','i','\0'};
int ImpCmd (uint32 uiID,
char *pcarg,
uint32 *puiPara )
{
int iArgc;
int i,j;
int iSucc=0;
uint32 uiNum;
char *pcArgv[12];
char temp[160];
char temp3[16];
uiNum = GucCmdTabNum[uiID]; /* 获取命令参数表参数的个数 */
if ( pcarg == NULL || puiPara == NULL ) {
return OPERATE_FAIL;
} else {
// char temp[160];
strcpy( temp, pcarg); /* 拷贝用户参数进行修改 */
iArgc = CmdStr(temp, pcArgv);
}
for (i=0; i<iArgc; i++) {
for (j=0; j<uiNum; j++) {
// char temp[16];
strcpy(temp3, Cmd_Tab[uiID][j]);
sscanf("ssss","%s",temp3);
strcat(temp3, temp2);
// if ( sscanf((char *)pcArgv,temp3,(puiPara+j)) != 0 ) {
// iSucc ++;
// break;
// }
}
}
LedOn(LED1);
return iSucc; /* 解析完参数的个数 */
}
现象:编译正常,但是程序跑到sscanf("ssss","%s",temp3); 里就死掉了,如果屏蔽sscanf("ssss","%s",temp3); 则一切正常,不解中。
这里sscanf("ssss","%s",temp3); 这个句子是测试sscanf用的,发现只要有sscanf就死掉。 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|