1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
以上代碼用unicode方式c編譯可以通過,運作時崩潰,編譯器會報個警告,兒非錯誤
test.c(13) : warning C4133: 'function' : incompatible types - from 'char [9]' to 'LPWSTR'
CreateProcessW 的第二個參數要去是LPWSTR ,這裡被強制轉換了而c++方式編譯的話會報錯,直接編譯不過
test.cpp(21) : error C2664: 'CreateProcessW' : cannot convert parameter 2 from 'const char [9]' to 'LPWSTR'