Function Purpose
fprintf Prints a formatted string to a file.
printf Prints a formatted string to stdout.
sprintf Prints a formatted string to a string buffer.
snprintf Prints a formatted string to a string buffer and the programmer can specify the length of data to be printed to the destination buffer.

Table 2: Common formatting functions in C vulnerable to format-string attacks.

Back to Article