How to save a input string in C++?
<pre><code>#include&lt;iostream&gt;
#include&lt;string&gt;
#include&lt;fstream&gt;
using namespace std;

int main()
{
  ofstream wysla;
  wysla.open("wysla.txt", ios::app);
  int kaput;
  string s1,s2;
  cout&lt;&lt;"Please select from the List below"&lt;&lt;endl;
  cout&lt;&lt;"1.New entry"&lt;&lt;endl;
  cout&lt;&lt;"2.View Previous Entries"&lt;&lt;endl;
  cout&lt;&lt;"3.Delete an entry"&lt;&lt;endl;
  cin&gt;&gt;kaput;
  switch (kaput)
  {
    case 1:

      cout&lt;&lt;"Dear diary,"&lt;&lt;endl;
      getline(cin,s1);
      wysla&lt;&lt;s1;
      wysla.close();

      break;
   }
   return 0;
}
</code></pre>

<p>In this code I have tried to save a string of characters but it is not possible e.g,.. when I use getline nothing is saved on the text file when I use cin only the first word is saved. I would like to save the whole entry what do I do?</p>
