How can I prevent strncpy_s from padding destination buffer in debug build?

后端 未结 2 1711
萌比男神i
萌比男神i 2021-01-19 04:27

I maintain a fairly large piece of legacy code that still uses strncpy a lot. I have now started the process of replacing the usage of strncpy with

2条回答
  •  猫巷女王i
    2021-01-19 05:13

    strcpy_s() will fill in the buffer with 'FE' in debug mode only.

    You can turn this off explicitly by calling _CrtSetDebugFillThreshold(0)

提交回复
热议问题