The input stream is therefore tied to the output stream such that a request for input will cause pending output to be flushed. Disabling the linkage between the input and output streams gets rid of this overhead. If the input stream is untied, then the prompt in the example above will not come out before input is requested from the user, leading to confusion. Note also that current libraries vary in their behavior. The above example works for one library that was tried, but for another, there appears to be no way to disable unit buffering under any circumstances, when output is to a terminal.
Copying files a character at a time has other pitfalls.
One has to be careful in assessing the buffering and function call overhead for anything done on a per-character basis. There is yet another way of copying files by character, using streambufs, that we'll present in a future issue. This will work, at least at compile time, but will probably give a link error about an unresolved symbol. There are two purposes for this mangling. One is to support function overloading.