Quote Originally Posted by Lindley View Post
Incidentally, does the read/write mode work if you make a sync() call between them? I know normally you're supposed to either use fseek() (which is not supported by that implementation, that's the incomplete part) or fflush() between reads and writes.
I have no idea. To be honest, this problem is a bit over my knowledge, and everything I tried here was on a "let's see what happens if I write this" basis. According to cplusplus, sync does nothing by default. In this case, I think there might be a use for it in mixed read/write, but I would not know how to use it. Further more, the provided implementation is not complete. It does basic read/write , but it lacks all seek and get functions. They are probably not too hard to implement though.

Quote Originally Posted by Lindley View Post
Oh, and I'm sure I'll grab it---could be useful. However, a virtual function call for every single character strikes me as serious overkill nonetheless.
Well technically, when using a normal fstream or a stringstream, you are calling streambuf's and stringbuf's functions via virtual call too, so syncstream's overhead should be any more than standard streams. Unless they have special optimizations.

...

Sill, I say interface comes before implementation. syncstream seems like the correct solution to me. If after trying syncstream, you notice you have an io bottleneck, then I guess it could be time to look for another solution.