title: using std::vector<std::string*> and std::vector<std::ofstream*>
body: <p>I want to create of <code>vector</code> of four <code>string</code> objects,and four <code>ofstream</code> objects, the <code>string</code> objects are used to name the output files and the <code>ofstream</code> objects are used to write the data.</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;fstream&gt;
  
  std::vector&lt;std::string*&gt; myFileNames; 
  std::vector&lt;std::ofstream*&gt; myFiles;
  int id[4]={1,2,3,4};
  
  for(int i=0; i&lt;4; i++)
  {
     myFiles.push_back(new std::ofstream);
     myFileNames.push_back(new std::string);
  
  }
  
  int tmp[4];
  
  for(int i=0; i&lt;4; i++)
  {
  
       tmp[i] = id[i] ;
      myFileNames[i] = "file";
      myFileNames[i] += tmp[i];
      myFileNames[i] += " .csv ";
  
      std::cout&lt;&lt; "Opening file:" &lt;&lt; myFileName[i] &lt;&lt; std::endl;
      myFiles[i].open (myFileNames[i].c_str());
      myFiles[i]&lt;&lt; "a,";
   }
  </code></pre>
  
  <p>The question is that from this line --<code>myFileNames[i] = "file";</code> the errors happen, it seems I can't give the values to <code>myFileNames</code> member in this way, could anyone help me with this, like I want to create four files with four different names, and give them values in a loop.</p>