C++ FILE without writing to disk
问题 I'm using a library that has quite a few functions that write to a FILE but none that seem to conveniently dump the same data to an object in memory. Is there any way to create a FILE object (or override it) that stores the data in memory instead of writing to disk -- I'd like to avoid the performance hit of opening/writing/reading from files over and over again. UPDATE: per Rob's suggestion, trying stringstream: ss.put(c); std::string myval = ss.str(); printf("Value: %s\n after writing: %i