use fgets or fread

It’s better to use a field specifier, or a combination of fgets and sscanf, to read in a line of input and scan it. This will prevent possible buffer overflows that could be exploited by a malicious user.
-- Begining Linux Programming 115 Chapter 3


Try to use other functions, like fread or fgets, to read input lines and the string functions to break the input into the items you need.
-- Begining Linux Programming 116 Chapter 3
posted on 2009-09-15 20:59  lbsx  阅读(179)  评论(0)    收藏  举报