for (int i =1;i<=iTelQH;i++) {
char a = tempNum[i];
这个肯定有问题了。VC中数组下标是从0开始的!!!要记住。所以tempNum[iTelQH]肯定就溢出了。最后一个数组成员是 tempNum[iTelQH-1]
修改为:
for (int i =0;i<iTelQH;i++) {
char a = tempNum[i];
for (int i =1;i<=iTelQH;i++) {
char a = tempNum[i];
switch(a)
{
case '1':
RecNum[i]=0x81;
break;
case '2':
RecNum[i]=0x82;
break;
case '3':
RecNum[i]=0x83;
break;
case '4':
RecNum[i]=0x84;
break;
case '5':
RecNum[i]=0x85;
break;
case '6':
RecNum[i]=0x86;
break;
case '7':
RecNum[i]=0x87;
break;
case '8':
RecNum[i]=0x88;
break;
case '9':
RecNum[i]=0x89;
break;
case '0':
RecNum[i]=0x8A;
break;
case '*':
RecNum[i] = 0x8B;
break;
case '#':
RecNum[i] = 0x8C;
break;
}