title: C++ Read txt and put each line into Dynamic Array
body: <p>I am trying to read input.txt file, and trying to put each line into the array as string (later on I will use each element of array in initializing obj that's why I am putting each line into the array).</p>
  <pre><code>    string* ptr = new string;
      
      // Read Mode for Input
      fstream input;
      input.open(&quot;input.txt&quot;, ios::in);
  
      int size = 0;
  
      if (input.is_open()) {
          string line;
          while (getline(input, line)) {
              cout &lt;&lt; line &lt;&lt; endl;
              ptr[size] = line;
              size++;
          }
          input.close();
      }
  
      for (int i = 0; i &lt; size-1; i++) {
          cout &lt;&lt; &quot;array: &quot; &lt;&lt; ptr[i] &lt;&lt; endl;
      }
  </code></pre>
  <p>I am getting error as:</p>
  <blockquote>
  <p>Proxy Allocated, drain it</p>
  </blockquote>