c++ Run-Time Check Failure #2 - Stack around the variable 'ToSend22' was corrupted
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.
精彩评论