monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] OT: c++ filebuf question


From: Zack Weinberg
Subject: [Monotone-devel] OT: c++ filebuf question
Date: Mon, 16 Feb 2009 18:54:16 -0800

This is kinda related to monotone, but really I'm asking here because,
of the mailing lists I'm on, it seems most likely that someone who
knows the answer will be here.

As far as I can tell, this is the most efficient way in standard C++
to write the entire contents of a string to a file:

  std::copy(data.begin(), data.end(), ostreambuf_iterator<char>(&fout));

('data' is the string, 'fout' is a std::filebuf opened on the file.)
The problem is I have no idea how to detect write errors.  Can anyone
tell me how to do that?  Also whether there's a less, er, abstruse way
to do this?

thanks in advance
zw




reply via email to

[Prev in Thread] Current Thread [Next in Thread]