title: std::endl in a string variable?
body: <p>Hi i want to save multiply lines in a string. I got a string logstring and i want to save multiplay error logs which i later can print in a txt file or as a console output. Is there a possibility to use endl to format a string variable? I searched the internet but i only find </p>
  
  <pre><code>cout &lt;&lt; "" &lt;&lt; endl;
  </code></pre>
  
  <p>Now my idea was:</p>
  
  <pre><code>std::string logstring;
  logstring = logstring + "Error Message" + "Number" + "Time + Date";
  logstring += endl;
  </code></pre>
  
  <p>Is something like this possible or is there no way to format string variables? Later i want to print them to a log.txt file? Is it possible to use a string like this?</p>
  
  <pre><code>std::ofstream logfile;
  logfile.open(log.txt);
  logfile &lt;&lt; logstring;
  </code></pre>
  
  <p>The text file should look like this</p>
  
  <pre><code>Error Message 1 Date
  Error Message 2 Date
  Error Message 3 Date
  ...
  </code></pre>
  
  <p>Is it possibly to get it like this or do i have to print all lines seperatly?</p>