<div dir="ltr">On Thu, Oct 27, 2011 at 10:48, Rustom Mody <span dir="ltr">&lt;<a href="mailto:rustompmody@gmail.com">rustompmody@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Can someone explain what is happening here?<br>
*Main&gt; getTwoChars<br>ab<br>(&#39;a&#39;,&#39;b&#39;)<br>*Main&gt; getTwoChars<br>a<br>(&#39;\n&#39;,&#39;a&#39;)<br></blockquote><div><br></div><div>The code is doing exactly what it says.  getTwoChars reads two characters --- *not* a line.  So the next character waiting to be read is the newline, which is returned by the next getTwoChars.</div>
<div><br></div><div>This may depend to some extent on the platform, as Unix defaults to a line-oriented input interface (at the OS level) but Windows to character-oriented input.</div></div><div><br></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>
wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br><br>
</div>