Friday, July 5, 2013

[Visual C++] Run-Time Check Failure #2 - Stack around the variable was corrupted

This run time error often happens when you try to write a string to a char[ ] whose size is smaller than the string.

ex:

char str[10];
char s10[] = "1234567890";

str[10] = 'a';         <----- error, size of str is 10, can only access str[0] ~ str[9]
strcpy( str, s10);   <----- error, size of s10 is 11, don't forget the end character '\0' or NULL

[Qt] 執行檔需要哪些 Dll?

 1. 使用 Qt  的 windeployqt.exe 工具 (在 C:\Qt\Qt5.14.1\5.14.1\msvc2017\bin\)。   a. 把執行檔 myProgram.exe 放在某個資料夾。   b. 在檔案總管這個資料夾按 Shift 和滑鼠右鍵,開啟 Po...