gets() is bad.

This tip submitted by Sean on 2004-12-28 00:00:00. It has been viewed 33854 times.
Rating of 5.7 with 220 votes



Using the gets() function in the C header stdio.h can cause a variety of unwanted side-effects (including buffer overflows). Instead, use fgets(), and specify stdin as the file pointer.



More tips

Help your fellow programmers! Add a tip!