<legend id='OzW5a'><style id='OzW5a'><dir id='OzW5a'><q id='OzW5a'></q></dir></style></legend>

        <tfoot id='OzW5a'></tfoot>

        <small id='OzW5a'></small><noframes id='OzW5a'>

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

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

        C++ 'strcpy' 发出警告 (C4996)

        C++ #39;strcpy#39; gives a Warning (C4996)(C++ strcpy 发出警告 (C4996))

          <small id='VUyWY'></small><noframes id='VUyWY'>

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

                  <tfoot id='VUyWY'></tfoot>

                  本文介绍了C++ 'strcpy' 发出警告 (C4996)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我收到此警告,但所有功能都正常工作.

                  I am getting this warning but all functions working properly .

                  这到底意味着什么?

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

                  推荐答案

                  这个函数 (strcpy) 被认为是不安全的,因为没有边界检查并且可能导致缓冲区溢出.(实际上 strcpy 因溢出漏洞而臭名昭著,所有程序员都避免使用它——或者至少应该避免使用它).建议是使用考虑目标缓冲区大小的安全函数以避免溢出.您也可以使用 strncpy (但要小心!).您的代码没有问题,即函数将按您说的方式运行,但尝试提供一个大于目标缓冲区的缓冲区作为输入.该函数将溢出目标缓冲区.检查这个也链接文本

                  This function (strcpy) is considered unsafe due to the fact that there is no bounds checking and can lead to buffer overflow. (Actually strcpy is infamous for overflow exploits and all programmers avoid it-or at least should avoid it). The advice is to use a safe function which takes into account the size of the destination buffer to avoid overflow. You could also use strncpy (BUT with caution!). There is no problem with your code, i.e. the functions will run as you say but try giving as input a buffer that is larger than the destination buffer. The function will overflow the destination buffer. Check this also link text

                  这篇关于C++ 'strcpy' 发出警告 (C4996)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to print vector#39;s data(如何打印矢量的数据)
                  Visual C++ appends 0xCC (int3) bytes at the end of functions(Visual C++ 在函数末尾附加 0xCC (int3) 字节)
                  How to use a variable inside a _T wrapper?(如何在 _T 包装器中使用变量?)
                  MSVC++ warning flags(MSVC++ 警告标志)
                  How to read file which contains uxxxx in vc++(如何在vc++中读取包含uxxxx的文件)
                  stack overflow error in C++ program(C++程序中的堆栈溢出错误)
                    <tbody id='oRr6F'></tbody>

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

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

                      <legend id='oRr6F'><style id='oRr6F'><dir id='oRr6F'><q id='oRr6F'></q></dir></style></legend>
                      1. <small id='oRr6F'></small><noframes id='oRr6F'>

                          <tfoot id='oRr6F'></tfoot>