title: How can fopen_s be more safe than fopen?
body: <p>I'm working on legacy code for <code>Windows</code> platform. When I compile the code in <code>VS2013</code>, it give following warning:</p>
  
  <blockquote>
    <p>error C4996: '<code>fopen</code>': This function or variable may be unsafe. Consider using <code>fopen_s</code> instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details."</p>
  </blockquote>
  
  <p>And it will also give samiliar warning for <code>sprintf</code>. I understand <code>sprintf_s</code> is more safe than sprintf because of buffer overflow.</p>
  
  <p>But how can be <a href="http://msdn.microsoft.com/zh-cn/library/z5hh6ee9%28v=vs.90%29.aspx" rel="nofollow noreferrer">fopen_s</a> be more safe than <code>fopen</code>, there is no chance of buffer overflow because <code>fopen</code> doesn't accept an buffer. Can anyone provide an case <code>fopen</code> is unsafe, and <code>fopen_s</code> is safe?</p>