Danny thank you for your reply. Actually isn't this what i actually do?
I mean i do write the size of each string through
Code:
Output<long>(o,params.size());
std::for_each(params.begin(),params.end(),std::bind1st(OutString,o));//do i use the std::bind1st function right?
since the OutString function is:
Code:
void OutString(std::ofstream &o, const std::string &s)
{
int size=s.size();
Output<int>(o,size);//stores the size of each string
o.write(s.c_str(),size);//stores the string itself
}
and the simple Output function:
Code:
template<typename T>
void Output(std::ofstream& o, T& t){
o.write(reinterpret_cast<char*>(&t),sizeof(T));
}
Bookmarks