C++ 500 Internal Server Error<title><head> <body bgcolor="white"> <center><h1>500 Internal Server Error<h1><center> <hr><center>nginx<center> <body> <html> </a></h1> </div> <div class="entry-info" style="padding: 4px 0 0 0;"> <time class="entry-date published"> 发布于05月26日 </time> </div> <div class="intro mb20"> <p>功能<code>strdup()</code>和<code>strndup()</code>最终成为即将推出的C23标准:</p> <blockquote> <p><strong>7.24.6.4 The 100 function</strong></p> <p><strong>Synopsis</strong><br></p> <pre><code>#include <string.h> char *strdup(const char *s); </code></pre> <p><code>strdup</code>函数在分配的空间中创建<code>s</code>指向的字符串的副本,就像调用<code>malloc</code>一样.</p> <p><strong>Returns</strong><br></p> <p><strong>7.24.6.5 The 100 function</strong></p> <p><strong>Synopsis</strong><br></p> <pre><code>#include <string.h> char *strndup(const char *s, size_t size); </code></pre> <p><code>strndup</code>函数在分配的空间中创建一个字符串,该字符串使用<code>s</code>指向的数组的不超过<code>size</code>个初始字符初始化,直至第一个空字符(以先到者为准),就像调用<code>malloc</code>一样.如果<code>s</code>所指向的数组在前<code>size</code>个字符内不包含null,则会将null附加到该数组的副本中.</p> <p><strong>Returns</strong><br></p> </blockquote> <p>为什么不考虑将POSIX-2008功能<code>strnlen</code>包括在内?</p> <pre><code>#include <string.h> size_t strnlen(const char *s, size_t maxlen); </code></pre> <p><code>strnlen()</code>函数应计算数组中<code>s</code>个指向的字节数(不包括终止NUL字符)或<code>maxlen</code>参数的值中的较小者.<code>strnlen()</code>函数不得判断<code>s</code>所指向的数组的<code>maxlen</code>个字节以上.</p> </div> </div> </div> <div class="q-single mt20"> <div class="intro mb20"> <div class="layui-card"> <div class="layui-card-header"><h2>推荐答案</h2></div> <div class="layui-card-body"> <p>有趣的是,这个函数是在<a href="https://www9.open-std.org/JTC1/SC22/WG14/www/docs/n2351.htm" rel="nofollow noreferrer">https://www9.open-std.org/JTC1/SC22/WG14/www/docs/n2351.htm</a>年提出的</p> <p>2019年伦敦会议讨论了这一问题.参见议程:</p> <p>讨论记录见<a href="https://www9.open-std.org/JTC1/SC22/WG14/www/docs/n2377.pdf" rel="nofollow noreferrer">https://www9.open-std.org/JTC1/SC22/WG14/www/docs/n2377.pdf</a>.</p> <p>由于没有达成共识,它被拒绝了.</p> <blockquote> <p>6.33 Sebor,将strnlen添加到C2X【N 2351】</p> <p>...</p> <p>*民意调查:N2351是否应投入C2X?</p> <p>(11/6/6)</p> <p>未达成明确共识.</p> </blockquote> <p>因此,未添加该函数.</p> </div> <div class="layui-card-footer"> <span id="share"></span> </div> </div> </div> </div> <div class="entry-content mt20"> <h2 class="tip_title">C++相关问答推荐</h2> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/78420691.html" title="try 使用libusb控制音量时LIBUSB_WRIGHT_PIPE">try 使用libusb控制音量时LIBUSB_WRIGHT_PIPE</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/78385945.html" title="获取二维数组的最大元素">获取二维数组的最大元素</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/78378970.html" title="为指针 struct 创建宏">为指针 struct 创建宏</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/78204305.html" title="为什么我得到更多的256假阳性在PKZIP解密密钥验证?">为什么我得到更多的256假阳性在PKZIP解密密钥验证?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/78055636.html" title="无法用C++编译我的单元测试">无法用C++编译我的单元测试</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77971457.html" title="LibpCap禁用监视器模式(C、MacOS)">LibpCap禁用监视器模式(C、MacOS)</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77948447.html" title="为什么sscanf不能正确地从这个字符串格式中提取所有数字?">为什么sscanf不能正确地从这个字符串格式中提取所有数字?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77807974.html" title="轮询libusb_pollfd struct 列表的正确方式是什么?">轮询libusb_pollfd struct 列表的正确方式是什么?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77793791.html" title="插座打开MacOS组件">插座打开MacOS组件</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77744504.html" title="如何使解释器存储变量">如何使解释器存储变量</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77719152.html" title="是否需要包括&lt;errno.h&gt;才能使用perror?">是否需要包括<;errno.h>;才能使用perror?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77696045.html" title="如何在POSIX-UEFI中获得输入?">如何在POSIX-UEFI中获得输入?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77682366.html" title="C I/O:在Windows控制台上处理键盘输入">C I/O:在Windows控制台上处理键盘输入</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77544894.html" title="为什么编译器不能简单地将数据从EDI转移到EAX?">为什么编译器不能简单地将数据从EDI转移到EAX?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77467782.html" title="如何在C中用bool进行文件I/O?">如何在C中用bool进行文件I/O?</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77311582.html" title="无算术运算符和循环的二进制乘法">无算术运算符和循环的二进制乘法</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77320918.html" title="存储和访问指向 struct 的指针数组">存储和访问指向 struct 的指针数组</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/77304976.html" title="意外的C并集结果">意外的C并集结果</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/76987856.html" title="SSE 向量与 Epsilon 的比较">SSE 向量与 Epsilon 的比较</a></h3> <h3 class="geekgay layui-elip h11"><a href="https://www.learnfk.com/question/c++/76936934.html" title="C 中从 Unix 纪元时间转换的损坏">C 中从 Unix 纪元时间转换的损坏</a></h3> <div class="clear"></div> </div> </div> <div class="layui-col-xs12 layui-col-md3 pl20 mt20"> <div class="layui-card"> <div class="layui-card-header">实用课程推荐</div> <div class="layui-card-body"> <ul class="geek-ul"> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100007201?code=cMzO9%2FAKYYzZSBPxewe1bVMRAFxRl-aDfugoa5y2R%2FI%3D" rel="nofollow" title="">从0开始学游戏开发 -〔蔡能〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/course/intro/100020301?code=wS47JHkOHToRCeOglP4IaZ64Krmcpz0T5txELo%2Fz3wI%3D" rel="nofollow" title="">Nginx核心知识150讲 -〔陶辉〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100032301?code=2eKjdut%2FBlT93TopVHkxCofVEQzwtwUuegMjyyPiSBg%3D" rel="nofollow" title="">消息队列高手课 -〔李玥〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100047701?code=L-g4a0wJBDgMX1N0WXt7p8-3WJVhGt4L4U9CujICVv4%3D" rel="nofollow" title="">Java业务开发常见错误100例 -〔朱晔〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100071001?code=AOWiNgQbC3KYIAHl73fgOnERtUf8kvY60fTAO3fwkow%3D" rel="nofollow" title="">Python自动化办公实战课 -〔尹会生〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100081901?code=Z0FBQR8tnx7utL-wDvW1pjkVnHf4E0h6X7F6PWJtqEI%3D" rel="nofollow" title="">如何读懂一首诗 -〔王天博〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100104301?code=e7XxhUoxJ5MX32QCAVmjH2z4UZuVx%2FaZpZA9jYAfscs%3D" rel="nofollow" title="">网络排查案例课 -〔杨胜辉〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100109601?code=XzjT0LF%2FbcNO-5zEFCv1mqaF0%2FzXAxbxrFEnS5LsTKU%3D" rel="nofollow" title="">超级访谈:对话汤峥嵘 -〔汤峥嵘〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100523801?code=C5Fa6KUNhDsfK544lrCEA7Vuc%2Fz%2FBxD109Jbjb9YaW4%3D" rel="nofollow" title="">现代C++20实战高手课 -〔卢誉声〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100524201?code=LLLdxcb6DWWCtVwMRz2fTtetfQWQltGuhVsD6LEOHnk%3D" rel="nofollow" title="">快速上手C++数据结构与算法 -〔王健伟〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/column/intro/100617601?code=IYI1%2FPCNtFpnt%2Fx2THCw1a5MBXRD1i75CKYMzvDk6AI%3D" rel="nofollow" title="">LangChain 实战课 -〔黄佳〕</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a target="_blank" href="https://time.geekbang.org/course/intro/100670901?code=fe5hHthhxZaJFXwsFR%2F4QpquwWaOCl8hAQGkqqC9t9A%3D" rel="nofollow" title="">给程序员的写作课 -〔高磊〕</a></p> </li> </ul> </div> </div> <div class="layui-card"> <div class="layui-card-header">相关教程推荐</div> <div class="layui-card-body"> <ul class="geek-ul"> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/dbutils/dbutils-tutorial.html" title="DBUtils">无涯教程 - DBUtils教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/linux/linux-tutorial.html" title="Linux">无涯教程 - Linux教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/graphql/graphql-tutorial.html" title="GraphQL">无涯教程 - GraphQL教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/nativescript/nativescript-tutorial.html" title="NativeScript">无涯教程 - NativeScript教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/ssh/ssh-tutorial-intro.html" title="SSH">无涯教程 - SSH教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/libtorch/libtorch-tutorial-intro.html" title="LibTorch">无涯教程 - LibTorch教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/javascript-design/javascript-design-tutorial-intro.html" title="JavaScript 设计模式">无涯教程 - JavaScript 设计模式教程</a></p> </li> <li class="geek-li layui-elip"> <p class="geekgay"><a href="https://www.learnfk.com/javascript-iot/javascript-iot-tutorial-intro.html" title="JavaScript 物联网编程">无涯教程 - JavaScript 物联网编程教程</a></p> </li> </ul> </div> </div> </div> </div> </div> </div> <div class="layui-footer footer footer-doc"> <div class="layui-main"> <div style="margin: 10px 0;text-align: center;" class="frient-link"> <a href="https://www.xiuxiandou.com" target="_blank" title="休闲君评测"><span>休闲君评测</span></a> |  <a href="https://www.toolfk.com" title="Programmer's toolbox" target="_blank">TOOLFK工具网</a> |  <a href="https://www.poemfk.com" title="古文传承网" target="_blank">古诗文网</a> |  <a href="https://www.lxlinux.net" title="良许Linux教程网" target="_blank">良许Linux教程网</a> |  <a href="https://foofish.net" title="Python之禅" target="_blank">Python之禅</a> |  <a href="https://redstonewill.com" title="红色石头" target="_blank">红色石头</a> |  <a href="https://www.rudangla.com" title="入党申请书" target="_blank">入党申请书</a> |  </div> <p> © 2020 <a href="https://www.learnfk.com/" title="无涯教程">Hi LearnFk</a> <a href="https://support.qq.com/products/163835" target="_blank" rel="nofollow">意见反馈</a> <a href="/disclaimer.html" title="免责声明" rel="nofollow">免责声明</a> <a href="/aboutus.html" title="关于我们" rel="nofollow">关于我们</a> <a href="https://beian.miit.gov.cn" target="_blank" rel="nofollow">桂ICP备11002319号-3</a> <span class="pl20"> 友链&广告位+QQ: 1963612630 </span> </p> </div> </div> <script src="/guide/js/layer/layer.js" charset="utf-8" ></script> <script> IS_ARTICLE = false; SHOW_JUMP = false; IS_SIGN = ""; </script> <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?autoload=true&lang=css" async></script> <script src="/guide/js/article.min.js?v4=1" async charset="utf-8"></script> <script src="/guide/js/clipboard.min.js" async charset="utf-8"></script> <ul class="layui-fixbar"> <li class="layui-icon layui-icon-transfer change-theme" lay-type="bar1" title="切换模式"></li> <li class="layui-icon layui-icon-print" lay-type="bar1" title="打印"></li> <li class="layui-icon layui-icon-login-wechat login-wechat" lay-type="bar1" title="关注我们"></li> <li class="layui-icon layui-fixbar-top layui-icon-top" lay-type="top" title="Top"></li> </ul> <script type="text/javascript"> $(function(){ $("body").delegate(".login-wechat","click",function(e){ e.stopPropagation(); var offset = "100px"; layer.open({ content: '<img src="/common/learnfk.jpg?v=2" width="220px;">', scrollbar: false, title:"关注我们", offset:offset }); }); $("a").click(function(){ if($(this).hasClass("demo-copy")){ return; } if($(this).hasClass("noload")){ return; } layer.load(); setTimeout(function(){ layer.closeAll(); },3000); }); $("pre").map(function(item){ if(!$(this).hasClass("prettyprint")){ $(this).addClass("prettyprint"); $(this).before('<div class="demo-view"><a href="javascript:;" class="demo-copy" title="Copy Code">复制代码</a></div>'); } }); $("body").delegate(".demo-view a.demo-copy", "click", function () { var that = $(this); var tran_text = that.parent(".demo-view").next(".prettyprint").text(); new ClipboardJS("a.demo-copy", { text: function (trigger) { layer.msg("复制成功"); return tran_text; } }); }); }); </script> <script type='text/javascript' src='https://platform-api.sharethis.com/js/sharethis.js#property=5fab445f7efc200012ec7197&product=sop' async='async' defer></script> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234706520155299" crossorigin="anonymous"></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-31321715-15"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-31321715-15'); </script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?fbe07850803babb5bcec215bbd0dc6a4"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script> (function(){ var el = document.createElement("script"); el.src = "https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?44422bbce4f642f723e6931a2fce9d632bd6aa77580fe4aad81efd527b26ed8a30632485602430134f60bc55ca391050b680e2741bf7233a8f1da9902314a3fa"; el.id = "ttzz"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(el, s); })(window) </script> </body> </html>