title: iostream limit max number of chars to read
body: <p>Learning C++ with help of Bruce Eckel "Thinking in C++". Stuck in exercise 05 of chapter "Iostreams":</p>
  
  <h2>Text of exercise</h2>
  
  <blockquote>
    <p>We know that setw( ) allows for a minimum of characters read in, but what if you wanted to read a
    maximum? Write an effector that allows the user to specify a maximum number of characters to
    extract. Have your effector also work for output, in such a way that output fields are truncated, if
    necessary, to stay within width limits.</p>
  </blockquote>
  
  <p>I understand how to create manipulators both without and with parameter (which one is called effectors in the book terminology). But do not understand how to limit maximum number of characters to extract. <code>std::ios_base::width</code> specifies the minimum number of characters.</p>
  
  <p>Shoud I do some tricks with underlying <code>streambuf</code> object?</p>