title: Does stream::seekoff update the input sequence?
body: <p>In <a href="http://eel.is/c++draft/filebuf.virtuals#13" rel="noreferrer">[filebuf.virtuals]</a>:</p>
  
  <blockquote>
  <pre><code>pos_type seekoff(off_type off, ios_base::seekdir way,
                   ios_base::openmode which
                     = ios_base::in | ios_base::out) override;
  </code></pre>
    
    <p><em>Effects:</em> Let <code>width</code> denote <code>a_­codecvt.encoding()</code>. If <code>is_­open() == false</code>, or <code>off != 0 &amp;&amp; width &lt;= 0</code>, then the positioning operation fails. Otherwise, if <code>way != basic_­ios​::​cur</code> or <code>off != 0</code>, and if the last operation was output, then update the output sequence and write any unshift sequence. Next, seek to the new position: if <code>width &gt; 0</code>, call <code>fseek(file, width * off, whence)</code>, otherwise call <code>fseek(file, 0, whence)</code>.</p>
  </blockquote>
  
  <p>It does not mention that this function updates the input sequence. As a contrast, <code>seekpos</code> does update the input sequence:</p>
  
  <blockquote>
  <pre><code>pos_type seekpos(pos_type sp,
                   ios_base::openmode which
                     = ios_base::in | ios_base::out) override;
  </code></pre>
    
    <p>Alters the file position, if possible, to correspond to the position stored in <code>sp</code> (as described below). Altering the file position performs as follows:</p>
    
    <ol>
    <li><p>if <code>(om &amp; ios_­base​::​out) != 0</code>, then update the output sequence and write any unshift sequence;</p></li>
    <li><p>set the file position to <code>sp</code> as if by a call to <code>fsetpos</code>;</p></li>
    <li><p>if <code>(om &amp; ios_­base​::​in) != 0</code>, then <strong>update the input sequence</strong>;</p></li>
    </ol>
  </blockquote>
  
  <p>So is <code>seekoff</code> guaranteed to update the input sequence?</p>
  
  <p>For a concrete example, consider:</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;iostream&gt;
  
  int main()
  {
      std::fstream f("test.txt"); // test.txt contains "test"
      char ch;
      f &gt;&gt; ch;
      f.rdbuf()-&gt;pubseekoff(0, std::ios_base::beg);
      f &gt;&gt; ch;
      std::cout &lt;&lt; ch;
  }
  </code></pre>
  
  <p>Is the program <strong>guaranteed</strong> to output <code>t</code>?</p>