开发者

c++ Run-Time Check Failure #2 - Stack around the variable 'ToSend22' was corrupted

开发者 https://www.devze.com 2023-03-26 22:48 出处:网络
I have no idea why is that happening - when ever I call this function I have and send TCP messages to the client, I\'ve got this:

I have no idea why is that happening - when ever I call this function I have and send TCP messages to the client, I've got this: Run-Time Check Failure #2 - Stack around the variable 'ToSend22' was corrupted. When开发者_如何学编程ever the client is disconnected. ToSend22 is STD string which I am doing

const char *ToSend288 = ToSend22.c_str();
Client.Send(ToSend288, ToSend22.size());

Why is that happening? Thanks.


Most probably Client.Send is modifying the char* buffer you are passing to it. Or other local variable in same function is being overwritten somehow, which is affecting ToSend22 variable. Array or pointer mis-use is definitely involved in this function.

Please post some more code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号