file io - C style regarding fprintf -
if program has many lines of code print string file, of following preferred? how important use preferred format?
fprintf(file, "%s", "string file"); fprintf(file, "string file");
fprintf(file, "%s", "string file"); fprintf(file, "string file");
if string printed variable in way former version preferred one, if strings constants, hard coded, save use latter.
the danger using latter version variable strings evil mind enter conversion specifiers (%d
, %s
, ...) string make code pull stack not meant pulled. leads mayor security issues.
Comments
Post a Comment