title: C++ std::string alternative to strcpy?
body: <p>I know there is a similarly titled question already on SO but I want to know my options for this specific case.  </p>
  
  <p>MSVC compiler gives a warning about strcpy:</p>
  
  <pre><code>1&gt;c:\something\mycontrol.cpp(65): warning C4996: 'strcpy': This function or
  variable may be unsafe. Consider using strcpy_s instead. To disable
  deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>void MyControl::SetFontFace(const char *faceName)
  {
      LOGFONT lf;
  
      CFont *currentFont = GetFont();
      currentFont-&gt;GetLogFont(&amp;lf);
      strcpy(lf.lfFaceName, faceName); &lt;--- offending line
      font_.DeleteObject();
      // Create the font.
      font_.CreateFontIndirect(&amp;lf);
  
      // Use the font to paint a control.
      SetFont(&amp;font_);
  }
  </code></pre>
  
  <p>Note <code>font_</code> is an instance variable. <code>LOGFONT</code> is a windows structure where <code>lfFaceName</code> is defined as <code>TCHAR lfFaceName[LF_FACESIZE]</code>.</p>
  
  <p>What I'm wondering is can I do something like the following (and if not why not):</p>
  
  <pre><code>void MyControl::SetFontFace(const std::string&amp; faceName)
  ...
    lf.lfFaceName = faceName.c_str();
  ...
  </code></pre>
  
  <p>Or if there is a different alternative altogether then let me know.</p>