cprintffputs

When should I use fputs instead of fprintf?


What exactly is the difference between the two?


Solution

  • fprintf does formatted output. That is, it reads and interprets a format string that you supply and writes to the output stream the results.

    fputs simply writes the string you supply it to the indicated output stream.

    fputs() doesn't have to parse the input string to figure out that all you want to do is print a string.fprintf() allows you to format at the time of outputting.