title: How can I generate an EOF (or an ASCII 0) in a visual studio debug console?
body: <p>I have a console-mode program running on Windows.   The program calls <code>getchar()</code> in a loop unitl either an <code>EOF</code> or a <code>0</code> is returned.   I'd like to enter one of the following as a test vector while running the debugger:  </p>
  
  <p>"<code>abc\0</code>"  or  "<code>abc\EOF</code></p>
  
  <p>I can't seem to consistently generate either.  I tried the suggestion <a href="https://stackoverflow.com/q/1793616/10396">in this question</a> by typing <kbd>a</kbd> <kbd>b</kbd><kbd>c</kbd><kbd>CTRL-Z</kbd><kbd>ENTER</kbd>".    That returns <code>97,98,99,26</code> to my program, and then hangs on the next <code>getchar()</code> call.   </p>
  
  <p>Entering <kbd>CTRL-D</kbd> doesn't hlep either, <code>getchar</code> returns a 4 for the control char, then a newline char, and then it duplicates the line I just entered on the console.  It's like VS is using the control characters as editing characters.</p>
  
  <p>EDIT:<br>
  Here is a stripped down version of the code I am using.  I see identical behavior in the debug console and in a command window.</p>
  
  <pre><code>#define MAXSZ 4096
  int main(int argc, char **argv)
  {
     short int data[MAXSZ]={0}, i=0; 
     char c;
     do {
        if (i==MAXSZ) break;
        c = getchar();
        if (c!=EOF) data[i]=c;
     } while (data[i++]!=0);
     for (i=0;data[i]&amp;&amp;i&lt;MAXSZ;i++)
        putchar(data[i]);
  }
  </code></pre>
  
  <p>How do I enter an EOF or an ASCII 0 in <strike>the Visual Studio debug</strike> a Windows console?</p>