gets() function is not available in Visual studio 2015 community

后端 未结 4 1913
-上瘾入骨i
-上瘾入骨i 2021-02-08 13:29

I have faced a compiler error(c3861) in my newly installed Visual studio community 2015 IDE:

I just want to use gets() function from stdio.h library, a

4条回答
  •  深忆病人
    2021-02-08 13:55

    The gets function was considered too dangerous (because it can easily cause a buffer overflow), so it was removed from the latest revisions of both C and C++.

    You are supposed to use fgets instead. With that function you can limit input to the size of your buffer.

提交回复
热议问题