I have an std::string
object containing binary data which I need to write to a file. Can ofstream f("name"); f << s;
be problematic in any way? I need to read the data back exactly as it was originally.
I can of course use fwrite(s.c_str(), s.size(), 1, filep)
, are there any pros / cons to either method?