strstr的使用 ( 积分: 10 )

  • 主题发起人 主题发起人 dxwwgr
  • 开始时间 开始时间
D

dxwwgr

Unregistered / Unconfirmed
GUEST, unregistred user!
char * pData;
char c[50];
......
pData=strstr(c,"XD4 S");
在调试环境下*.cgl文件报错如下
Error 00115. 0x130500 (Thread 0x0910):
Access overrun: Attempt to access 51 byte(s) at 0x0012FBB8, that is at local
block 0x0012FBB8(=[ebp-0x100] @Server.exe:0x01:027708) which is only 50 bytes
long.
strstr(0x0012FBB8 ["ES/r/nI4 A "1121230158"/r/nXD5 S -0.005 g 3 1 10
0/r/n"], 0x004F0A6C ["XD4 S"])
Call Tree:
0x00428708(=Server.exe:0x01:027708) C:/Documents and Settings/Administrator/桌面/zn0612/程序/服务器程序/Exe/ReadWeighComData.cpp#124
0x00428403(=Server.exe:0x01:027403) C:/Documents and Settings/Administrator/桌面/zn0612/程序/服务器程序/Exe/ReadWeighComData.cpp#35
0x00402362(=Server.exe:0x01:001362) C:/Documents and Settings/Administrator/桌面/zn0612/程序/服务器程序/Exe/Main.cpp#234
0x0046D241(=Server.exe:0x01:06C241) F:/Program/CB5/Foundation/Package/Communication/SComm.cpp#504
0x0046C324(=Server.exe:0x01:06B324) F:/Program/CB5/Foundation/Package/Communication/SComm.cpp#104
0x004CEA70(=Server.exe:0x01:0CDA70) Classes.pas#7282
 
char * pData;
char c[50];
......
pData=strstr(c,"XD4 S");
在调试环境下*.cgl文件报错如下
Error 00115. 0x130500 (Thread 0x0910):
Access overrun: Attempt to access 51 byte(s) at 0x0012FBB8, that is at local
block 0x0012FBB8(=[ebp-0x100] @Server.exe:0x01:027708) which is only 50 bytes
long.
strstr(0x0012FBB8 ["ES/r/nI4 A "1121230158"/r/nXD5 S -0.005 g 3 1 10
0/r/n"], 0x004F0A6C ["XD4 S"])
Call Tree:
0x00428708(=Server.exe:0x01:027708) C:/Documents and Settings/Administrator/桌面/zn0612/程序/服务器程序/Exe/ReadWeighComData.cpp#124
0x00428403(=Server.exe:0x01:027403) C:/Documents and Settings/Administrator/桌面/zn0612/程序/服务器程序/Exe/ReadWeighComData.cpp#35
0x00402362(=Server.exe:0x01:001362) C:/Documents and Settings/Administrator/桌面/zn0612/程序/服务器程序/Exe/Main.cpp#234
0x0046D241(=Server.exe:0x01:06C241) F:/Program/CB5/Foundation/Package/Communication/SComm.cpp#504
0x0046C324(=Server.exe:0x01:06B324) F:/Program/CB5/Foundation/Package/Communication/SComm.cpp#104
0x004CEA70(=Server.exe:0x01:0CDA70) Classes.pas#7282
 
好像是报数组越届了,把数组加大吧
 
谢谢你,我试试看
 
后退
顶部