gets_s()
function is not working on my compiler. I am using codeblocks with GCC.
This is the error :
undefined reference to '_imp_gets_s.
Can anyone please tell me how to resolve this error.
gets_s()
function is not working on my compiler. I am using codeblocks with GCC.
This is the error :
undefined reference to '_imp_gets_s.
Can anyone please tell me how to resolve this error.
You should be using fgets()
over gets()
or gets_s()
.
Referrring C11
, §K.3.5.4.1, paragraph 6,
The
fgets()
function allows properly-written programs to safely process input lines too long to store in the result array. In general this requires that callers offgets()
pay attention to the presence or absence of a new-line character in the result array. Consider usingfgets()
(along with any needed processing based on new-line characters) instead ofgets_s()
.