<tfoot id='y13fd'></tfoot>
    1. <small id='y13fd'></small><noframes id='y13fd'>

        <legend id='y13fd'><style id='y13fd'><dir id='y13fd'><q id='y13fd'></q></dir></style></legend>
        <i id='y13fd'><tr id='y13fd'><dt id='y13fd'><q id='y13fd'><span id='y13fd'><b id='y13fd'><form id='y13fd'><ins id='y13fd'></ins><ul id='y13fd'></ul><sub id='y13fd'></sub></form><legend id='y13fd'></legend><bdo id='y13fd'><pre id='y13fd'><center id='y13fd'></center></pre></bdo></b><th id='y13fd'></th></span></q></dt></tr></i><div id='y13fd'><tfoot id='y13fd'></tfoot><dl id='y13fd'><fieldset id='y13fd'></fieldset></dl></div>

        • <bdo id='y13fd'></bdo><ul id='y13fd'></ul>

        “strcpy"和“strcpy_s"之间的区别?

        时间:2023-10-06
        <i id='4YoRg'><tr id='4YoRg'><dt id='4YoRg'><q id='4YoRg'><span id='4YoRg'><b id='4YoRg'><form id='4YoRg'><ins id='4YoRg'></ins><ul id='4YoRg'></ul><sub id='4YoRg'></sub></form><legend id='4YoRg'></legend><bdo id='4YoRg'><pre id='4YoRg'><center id='4YoRg'></center></pre></bdo></b><th id='4YoRg'></th></span></q></dt></tr></i><div id='4YoRg'><tfoot id='4YoRg'></tfoot><dl id='4YoRg'><fieldset id='4YoRg'></fieldset></dl></div>

        <small id='4YoRg'></small><noframes id='4YoRg'>

        1. <tfoot id='4YoRg'></tfoot>
          • <bdo id='4YoRg'></bdo><ul id='4YoRg'></ul>

              <legend id='4YoRg'><style id='4YoRg'><dir id='4YoRg'><q id='4YoRg'></q></dir></style></legend>
                <tbody id='4YoRg'></tbody>
                • 本文介绍了“strcpy"和“strcpy_s"之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  当我尝试使用 strcpy 复制字符串时,它给了我一个编译错误.

                  When i tries to use strcpy to copy a string it gave me a compile error.

                  error 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.
                  

                  strcpystrcpy_s 有什么区别?

                  推荐答案

                  strcpy 是一个不安全的函数.当您尝试使用 strcpy() 将字符串复制到不足以容纳它的缓冲区时,会导致缓冲区溢出.

                  strcpy is a unsafe function. When you try to copy a string using strcpy() to a buffer which is not large enough to contain it, it will cause a buffer overflow.

                  strcpy_s()strcpy()安全增强版.使用 strcpy_s,您可以指定目标缓冲区的大小,以避免复制期间缓冲区溢出.

                  strcpy_s() is a security enhanced version of strcpy(). With strcpy_s you can specify the size of the destination buffer to avoid buffer overflows during copies.

                  char tuna[5];  // a buffer which holds 5 chars incluing the null character.
                  char salmon[] = "A string which is longer than 5 chars";
                  
                  strcpy( tuna, salmon ); // This will corrupt your memory because of the buffer overflow.
                  
                  strcpy_s( tuna, 5, salmon ); // strcpy_s will not write more than 5 chars.
                  

                  这篇关于“strcpy"和“strcpy_s"之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 Microsoft Visual Studio C++ 中以 Windows XP 为目标 下一篇:如何使用 Visual Studio 2012 为 Windows XP 进行编译?

                  相关文章

                  最新文章

                    <i id='rGxua'><tr id='rGxua'><dt id='rGxua'><q id='rGxua'><span id='rGxua'><b id='rGxua'><form id='rGxua'><ins id='rGxua'></ins><ul id='rGxua'></ul><sub id='rGxua'></sub></form><legend id='rGxua'></legend><bdo id='rGxua'><pre id='rGxua'><center id='rGxua'></center></pre></bdo></b><th id='rGxua'></th></span></q></dt></tr></i><div id='rGxua'><tfoot id='rGxua'></tfoot><dl id='rGxua'><fieldset id='rGxua'></fieldset></dl></div>
                    • <bdo id='rGxua'></bdo><ul id='rGxua'></ul>

                    1. <small id='rGxua'></small><noframes id='rGxua'>

                      <tfoot id='rGxua'></tfoot><legend id='rGxua'><style id='rGxua'><dir id='rGxua'><q id='rGxua'></q></dir></style></legend>