title: C++, strftime to string
body: <p>I make such function to get required time info in string form.</p>
  
  <pre><code>string gettimeinfo()
  {
      tm * timeinfo;
      time_t rawtime;
      char timebuff[120] = {0};
      time(&amp;rawtime);
      timeinfo = localtime(&amp;rawtime);
      strftime(timebuff, 120, "%d.%m.%Y. %H:%M:%S %x %W %I:%M %p %a %b %A %B %Z\n", timeinfo);
      return string(timebuff);
  }
  </code></pre>
  
  <p>This compiles without error and works as expected.<br>
  But when debugging on code:blocks/GCC program stops at return statement and debug warning appear:</p>
  
  <pre><code>In std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) () ()
  </code></pre>
  
  <p>What happens and how to get rid of this?</p>
  
  <p>EDIT: Whole error is:</p>
  
  <pre><code>In std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, unsigned int, std::allocator&lt;char&gt; const&amp;) () ()
  #1  0x004013fe in gettimeinfo () at C:\programi\[connectcpp\general.cpp:36
  C:\programi\[connectcpp\general.cpp:36:785:beg:0x4013fe
  At C:\programi\[connectcpp\general.cpp:36
  In char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) () ()
  In std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator&lt;char&gt; const&amp;) () ()
  In operator new(unsigned int) () ()
  </code></pre>