Is there a way to use fopen_s() with GCC or at least create a #define about it?

前端 未结 6 920
遇见更好的自我
遇见更好的自我 2020-12-05 10:54

MSVC compiler says that fopen() is deprecated, and recommends the use of fopen_s().

Is there any way to use fopen_s() and stil

6条回答
  •  天涯浪人
    2020-12-05 11:31

    Accroding to https://en.cppreference.com/w/c/io/fopen it's possible to enable *_s functions on the standard library:

    As with all bounds-checked functions, fopen_s is only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including .

提交回复
热议问题