Allow fprint and friends to take in std::basic_string instead of
regular char arrays.

Removed the duplicated code in sprint and moved it into the
print.hpp header.
Added some tests for io.hpp.