title: Save and open vector to and from a file c++?
body: <p>I am working on some sort of a notepad in c++. My idea is that user will be able to set a category and tags for each notes. Then he will be save the note and open it, while my program will keep those tags and category. However I am not sure how to exactly save vector to file and then open it so I can have access to it.</p>
  
  <pre><code>if ( infile . is_open() )
  {
     while ( !in_file . eof () ) 
     {      
         infile &gt;&gt; category;
     }
  }
  
  ofstream f ( filename ) 
  if ( f . is_open () )
  {
     f &lt;&lt; category;
  }
  
  f . close ();
  </code></pre>
  
  <p>The code above works just fine for saving and opening file with category, however I don't know how to do the same with vector of strings for tags. Anybody who could help me out with this would be much appreciated.</p>