rdbuf() stream

  • Thread starter Zaharije Pasalic
  • Start date
Z

Zaharije Pasalic

What is purpose of rdbuf methode of stream class? Is rdbuf create new
buffer or just return some kind of pointer to existing?

Thanks,
Zaharije Pasalic
 
I

Ivan Vecerina

Zaharije Pasalic said:
What is purpose of rdbuf methode of stream class? Is rdbuf create new
buffer or just return some kind of pointer to existing?
A pointer to the existing buffer.

All the stream classes (fstream, stringstream) derive from the
same base class(es) (stream, ostream, etc), without overriding
any virtual functions (except the destructor). However, each
of these subclasses stores internally a different kind of
stream buffer class, which is polymorphic, and decides what
the source/destination of the stream's data should be.


hth -Ivan
 
D

Dietmar Kuehl

Zaharije said:
What is purpose of rdbuf methode of stream class? Is rdbuf create new
buffer or just return some kind of pointer to existing?

'rdbuf()' accesses the stream buffer associated with a stream. There
are two overloads for 'rdbuf()', one reading the stream buffer and
one setting it (why it is called "rdbuf" is, however, beyond me).
Stream buffers abstract the character sequence a stream writes to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top