title: Keeping Console Window Open in Visual Studio (C)
body: <p>I usually use XCode but was having a problem opening a file with this code:</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void )
  {
     printf("Hello");
     FILE *filePtr;
  
     filePtr = fopen( "test.txt", "r" );
     if (filePtr == NULL)
     {
        fprintf(stderr, "Can't open \"test\"\n");
        exit(EXIT_FAILURE);
     }
     else
     {
        int x;
  
        printf("File open successful\n");
        /* read one character at a time until EOF is reached */
        while ((x = fgetc(filePtr)) != EOF)
        {
           //printf("%c", x);
           fprintf(stderr, "%x\n",x);
        }
     }
     fclose(filePtr);
     system("pause");
  
     return EXIT_FAILURE;
  }
  </code></pre>
  
  <p>The console window closes so fast and at the bottom bar of VS it says: "'C_test.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
  The program '[1116] C_test.exe: Native' has exited with code 1 (0x1)."
  What does that mean?</p>
  
  <p>Also, can anyone point me to good VS starting points / tutorials?</p>