主题:函数调用死机问题

  共有22711人关注过本帖    
湖北孝感
1楼


函数调用死机问题  发帖心情 Post By:2005-10-16 11:34:00   [只看该作者]

我用的是ETR186T,在实现TCP/IP远程数据传输过程中,如果我把传送代码用子函数实现,在函数退出时死机(INT6@2E35:387D),但我用相同的代码直接在主程序中(不用函数调用),则不死机,不知为什么?
我的函数是:
int GPRSReg()
{

     unsigned char   GPRSTxdBuf[1024];
     unsigned char   buf[4];
     int i;
     unsigned char sum=0;

     i=GetOWNIP( GPRSTxdBuf );
     sprintf( buf,"IP=%d.%d.%d.%d", GPRSTxdBuf[0],GPRSTxdBuf[1], GPRSTxdBuf[2],
                                GPRSTxdBuf[3] );

     GPRSTxdBuf[0]=0x68;
     GPRSTxdBuf[3]=0x68;
     GPRSTxdBuf[1]=0x15;
     GPRSTxdBuf[2]=0xea;  //协议头

     GPRSTxdBuf[4]=0x00;
     sum= sum+  GPRSTxdBuf[4];
     GPRSTxdBuf[5]=0x00;
     sum= sum+  GPRSTxdBuf[5];
     GPRSTxdBuf[6]=0x00;
     sum= sum+  GPRSTxdBuf[6];
     GPRSTxdBuf[7]=0x01;
     sum= sum+  GPRSTxdBuf[7];

     GPRSTxdBuf[8]=0xC1;
     sum= sum+  GPRSTxdBuf[8];
     
     GPRSTxdBuf[9] =0x13;
     sum= sum+  GPRSTxdBuf[9]+0x33;
     GPRSTxdBuf[10]=0x47;
      sum= sum+  GPRSTxdBuf[10]+0x33;
     GPRSTxdBuf[11]=0x65;
      sum= sum+  GPRSTxdBuf[11]+0x33;
     GPRSTxdBuf[12]=0x48;
      sum= sum+  GPRSTxdBuf[12]+0x33;
     GPRSTxdBuf[13]=0x83;
      sum= sum+  GPRSTxdBuf[13]+0x33;
     GPRSTxdBuf[14]=0x3F;
      sum= sum+  GPRSTxdBuf[14]+0x33;
     
     GPRSTxdBuf[15]=buf[0];
      sum= sum+  GPRSTxdBuf[15]+0x33;
     GPRSTxdBuf[16]=buf[1];
      sum= sum+  GPRSTxdBuf[16]+0x33;
     GPRSTxdBuf[17]=buf[2];
      sum= sum+  GPRSTxdBuf[17]+0x33;
     GPRSTxdBuf[18]=buf[3];
      sum= sum+  GPRSTxdBuf[18]+0x33;
     
     GPRSTxdBuf[19]=0x17;
      sum= sum+  GPRSTxdBuf[19]+0x33;
     GPRSTxdBuf[20]=0x77;
      sum= sum+  GPRSTxdBuf[20]+0x33;
      sum=sum+0x33;
     GPRSTxdBuf[21]=sum;
     GPRSTxdBuf[22]=0x16;
     GPRSTxdBuf[23]=<|>\0<|>;
 /*    strcpy(GPRSTxdBuf,"123");
     i = strlen( GPRSTxdBuf ) 
     GPRSTxdBuf[24] =<|>\0<|>;
     GPRSTxdBuf[25] =<|>\0<|>;    */
     i=TCPCManager->WriteData( GPRSTxdBuf, 23 );
     return i;
}

  单帖管理 | 引用 | 回复 回到顶部
zhl
2楼


  发帖心情 Post By:2005-10-17 9:36:00   [只看该作者]

仅从这段代码中看不出什么问题,你发的程序已经收到了。我们看了后再和你联系。

  单帖管理 | 引用 | 回复 回到顶部

返回首页

函数调用死机问题

用户名:
            验证码: 验证码,看不清楚?请点击刷新验证码
内容: