Difference between filestream and filebuf
Hello to all, what is the difference between these two clasees ?
fstream and stringstream derived from class stream.
filebuf and stringbuf derived from class streambuf.
And ofstream also used filebuf as its underlying implementation write to file.
Besides that, we can derived from streambuf for custom use.
Thanks.
Re: Difference between filestream and filebuf
I hope someone can explain this.
Re: Difference between filestream and filebuf
never knew about the *buf classes. Googling it tells me the difference is that stringstream is a class for "users" and stringbuf is a class for "developers." In other words if you want to develop your own stringstream, then you can derive from stringbuf. However, most developers will use stringstream as they are interesed in "using" a string API, not "developing" one. Hope that helps.