I am using Visual Studio 2015 and ReSharper for my C programs but I can not make gets method work in this IDE. Why is this method not shown in autocomplete list?
Asked
Active
Viewed 68 times
-3
-
5The `gets` function have been deprecated since the C99 standard, and was removed in the C11 standard. It's [a dangerous function](https://stackoverflow.com/questions/1694036/why-is-the-gets-function-so-dangerous-that-it-should-not-be-used), do not use it! – Some programmer dude Sep 19 '18 at 09:45
-
2Use `fgets()` instead. – Shawn Sep 19 '18 at 09:49
-
thank you for the answer... – Applik Sep 19 '18 at 10:25
-
C does not support _methods_. `gets` was a _function_. – too honest for this site Sep 19 '18 at 12:12
-
1Please post text rather than images. They may not be visible to all users -- or any searches. – Tim Randall Sep 19 '18 at 12:59
1 Answers
2
From the C documentation:.
The gets() function does not perform bounds checking, therefore this function is extremely vulnerable to buffer-overflow attacks. It cannot be used safely (unless the program runs in an environment which restricts what can appear on stdin). For this reason, the function has been deprecated in the third corrigendum to the C99 standard and removed altogether in the C11 standard. fgets() and gets_s() are the recommended replacements.
Never use gets().

P.W
- 26,289
- 6
- 39
- 76
-
cppreference is not **the** C documentation. That would be the standard as ther only official reference. – too honest for this site Sep 19 '18 at 13:25