You can Google up any C or C++ function name and chances are you'll find a document that tells you which header file you need to #include to use it.
But since you are using C++ you might want to use C++ streams. Check out this site's tutorial an reference and learn about file streams (#include <fstream> if I recall correctly).
UPDATE: BTW, I quickly used what you wrote to Google, and it turns out you mispelled the function. It is fprintf().