title: can't read the txt file by using ifstream in c++ (cpp)
body: <p>I'm trying to make the c++ program that read the alphabet from &quot;abc.txt&quot; and split by space, and then save in array (arrFirst).</p>
  <p>My environment is Visual Studio 2019.</p>
  <p>(I'm not good at English. I'm sorry if my writing is hard to read)</p>
  <p>This is my code, and I have &quot;abc.txt&quot; in same directory with this .cpp file.</p>
  <p>This code can't open the &quot;abc.txt&quot; file.</p>
  <p>I can't understand why this code can't open the file.</p>
  <p>Could you tell me why this code can't open the txt file??</p>
  <p>Thank you.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  int main()
  {
      char arrFirst[30];
  
      int position = 0;
      int arrFirstSize = sizeof(arrFirst) / sizeof(arrFirst[0]);
  
      ifstream fin;
      fin.open(&quot;abc.txt&quot;);
      if (fin.is_open())
      {
          cout &lt;&lt; &quot;File Opened Successfully! &quot; &lt;&lt; endl;
          while (!fin.eof() &amp;&amp; position &lt; arrFirstSize);
          {
              fin.get(arrFirst[position]);
              position++;
          }
          arrFirst[position - 1] = '\0';
  
          cout &lt;&lt; &quot;Displaying Array... &quot; &lt;&lt; endl &lt;&lt; endl;
          for (int i = 0; arrFirst[i] != '\0'; i++)
          {
              cout &lt;&lt; arrFirst[i];
          }
      }
      else
      {
          cout &lt;&lt; &quot;File could not be opened.&quot; &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>