#include #include int main(int argc, char** argv) { std::string name = "foo", description = "bar"; bool holdItems = 1, moveable = 0, compositable = 1; std::ofstream fout; fout.open("temp.txt"); std::string temp; std::ostringstream stream; // stringstream object to strings to ints fout << name << std::endl; fout << description << std::endl; if(!(stream << holdItems)) return false; // something broke temp = stream.str(); fout << temp << std::endl; stream.clear(); if(!(stream << moveable)) return false; // something broke temp = stream.str(); fout << temp << std::endl; stream.clear(); if(!(stream << compositable)) return false; // something broke temp = stream.str(); fout << temp << std::endl; stream.clear(); return 0; }