Search code examples
c++printfinternals

How does fprintf work in C++?


How does fprintf work?

If I write fprintf(outfile, "test %d %d 255/r", 255, 255);

What does it mean? I know that outfile is the name my of output file. What would the other values mean?


Solution

  • "test %d %d 255/r" tells that after it will be arguments (and they are there: 255, 255) and they are expected to be of integer type. And they will be placed instead of %d.

    In result you'll get string test 255 255 255 in your file.

    For more infrormation read std::fprintf reference.