Saturday, April 2, 2011

Things to avoid in C/C++

avoid gets() -> use fgets()

Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead.


http://www.gidnetwork.com/b-56.html
avoid fflush(), scanf()
http://www.gidnetwork.com/b-57.html

No comments: