char转ansistring出错,为什么?
很久以前的一个程序,以前运行没有问题,现在要修改,重装了bc6,执行出错,请问为什么?
AnsiString TForm1::BcdToStr(char bcd)
{
AnsiString returnstring = "";
char high_char,low_char;
high_char = (bcd&0xf0)>>4;
low_char = bcd&0x0f;
if ((high_char>=0x00)&&(high_char<=0x09))
high_char+=0x30;
if ((high_char>=0x0A)&&(high_char<=0x0F))
high_char+=0x37;
if ((low_char>=0x00)&&(low_char<=0x09))
low_char+=0x30;
if ((low_char>=0x0A)&&(low_char<=0x0F))
low_char+=0x37;
returnstring += AnsiString(high_char);-----此处出错
returnstring += AnsiString(low_char);
return returnstring;
}
[解决办法]
重新完整的编译一次,如果还不行,只好重建工程文件,将原有的文件再加进来。