gets() is bad.

This tip submitted by Sean on 2004-12-28 00:00:00. It has been viewed 41984 times.
Rating of 5.9 with 271 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!