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

Popular posts from this blog

c++ - Creating new partition disk winapi -

VBA function to include CDATA -

php - Warning: file_get_contents() expects parameter 1 to be a valid path, array given 16 -