uestcheng 发表于 2011-11-21 14:59:28

使用lr_out_message出现提示Exception ACCESS_VIOLATION received.

本帖最后由 uestcheng 于 2011-11-21 16:02 编辑

代码:
#include "lrs.h"
#define hardversion "KTG-3-MAIN V3.31 &GSM"
#define softversion "MY-32F103-G V1.3.111115"
#define updatepacketbuff = "0100"



char sendbuf;
char registerPacket()
{



char terminalid;

char *p;

char *i;

int c;



p = &sendbuf;

*p++ = '*';

*p++ = '0';

*p++ = '0';

*p++ = 'e';

*p++ = 'C';



sprintf(terminalid,"%s",lr_eval_string("{ID}"));

*p++ = ',';



c = 0;

while ((hardversion != '\0')&& (c < 20)) {

*p++ = hardversion;

c++;

}



*p++ = ',';



c = 0;

while ((softversion != '\0')&&(c < 20)) {

*p++ = softversion;

c++;

}



*p++ = ',';

return sendbuf;


}
Action()
{

registerPacket();

lr_output_message("%s",sendbuf);

return 0;
}


提示信息:
Action.c(22): Warning: Invalid parameter detected in function.
Action.c(46): Error: C interpreter run time error: Action.c (46):Error -- memory violation : Exception ACCESS_VIOLATION received.
Action.c(46): Notify: CCI trace: Action.c(46): lr_output_message(0x012c035c "%s", 42)
.
Action.c(46): Notify: CCI trace: Compiled_code(0): Action()

msnshow 发表于 2011-11-21 23:03:04

像是语法错误

thirfing 发表于 2011-11-22 09:47:39

sprintf(terminalid,"%s",lr_eval_string("{ID}"));
ID定义。?
char* sendbuf;
页: [1]
查看完整版本: 使用lr_out_message出现提示Exception ACCESS_VIOLATION received.