gets() is bad.

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