title: GetChar() function strange
body: <ul>
  <li>List item</li>
  </ul>
  
  <p>I have a problem using <code>getchar()</code> method.What I am trying is to compute a small assembly simulator with 8 commands that are written by the user under the form <code>ADD Rx Ry</code> where <code>Rx</code> and <code>Ry</code> are the registers. I am not allowed to use strings nor arrays so the only option is to read char by char.</p>
  
  <p>My problem is that I don't know how to read multiple characters from one line of input text and put it in variables.For example, <code>ADD Rx Ry</code> I want to store <code>A</code> in <code>ch1</code>, <code>D</code> in <code>ch2</code> and <code>D</code> in <code>ch3</code> then skip space verify <code>R</code> and store <code>x</code> in a variable and then the same for <code>y</code>.</p>
  
  <p>The strange thing is that when I input the second command after the initial one, the program that is shown below just won't show the exact same print values(the printing is just for debugging)</p>
  
  <pre><code>do{
    ch1=getchar();
    ch2=getchar();
    ch3=getchar();
    if(ch1=='E' &amp;&amp; ch2=='N'&amp;&amp; ch3=='D'){
      break;
    }
      printf("%c",ch1);
      printf("%c",ch2);
      printf("%c",ch3);
  }while(1);
  </code></pre>