看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++ and G++ 原本使用sprintf 但VC卻會用error的方式叫我使用sprintf_s 查了一下, 想說用snprintf 可以跨平台, 以下是我的測試程式 http://ideone.com/3m8JXn 這段code在VC可以跑出正確的數值(用sprintf_s也ok) 我不懂為什麼snprintf在這情況下會出現問題... 順便請教為什麼微軟要弄一個sprintf_s 這種非標準的函數...明明就有snprintf阿? 煩請各位解惑 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.218.186.168 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1458823523.A.A62.html
yvb: google: man posix snprintf , 點進去後, 找 overlap 字樣 03/24 20:59
kwpn: 專案設定preprocessor definition加_CRT_SECURE_NO_WARNINGS 03/25 16:37