我將BufferOut
定義爲16元素數組。堆棧周圍變量損壞。爲什麼會發生?
但我在調試時遇到此消息。
Run-Time Check Failure #2 - Stack around the variable 'BufferOut' was corrupted.
HIDBufferOut
是char
陣列的16元件
HIDBufferOut BufferOut; // first element is the report ID
BufferOut[0] = 0;
BufferOut[1] = 211;
BufferOut[16] = 44;
BufferOut[4] = 4;
.
.
.
.
etc
錯誤消息足夠描述。如果你不能弄明白,那麼我們也不能沒有看到源代碼。 – ybungalobill
'HIDBufferOut BufferOut; \t \t \t // \t第一元件是報告ID \t \t BUFFEROUT [0] = 0; \t \t BufferOut [1] = Marker(); \t \t BufferOut [16] =(int)44; \t \t BufferOut [4] = typ; ' –
因爲你在數組中插入了第17個元素 –