<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Fopen on chai2010 的博客</title>
    <link>https://chai2010.cn/tags/fopen/</link>
    <description>Recent content in Fopen on chai2010 的博客</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-CN</language>
    <lastBuildDate>Thu, 28 Jul 2011 00:00:00 +0000</lastBuildDate>
    
        <atom:link href="https://chai2010.cn/tags/fopen/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>fopen打开的最大文件数目</title>
      <link>https://chai2010.cn/post/2011/fopen-max-num/</link>
      <pubDate>Thu, 28 Jul 2011 00:00:00 +0000</pubDate>
      
      <guid>https://chai2010.cn/post/2011/fopen-max-num/</guid>
      
        <description>

&lt;h3 id=&#34;windows环境&#34;&gt;Windows环境&lt;/h3&gt;

&lt;p&gt;可以用_getmaxstdio/_setmaxstdio 查询/设置.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// crt_setmaxstdio.c #include &amp;lt;stdio.h&amp;gt;
int main() {
    printf(&amp;quot;%d\n&amp;quot;,_getmaxstdio());
    _setmaxstdio(2048);
    printf(&amp;quot;%d\n&amp;quot;,_getmaxstdio());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;XP默认好像是512, 其中包含stdin/stdout/stderr.&lt;/p&gt;

&lt;h3 id=&#34;linux-环境&#34;&gt;Linux 环境&lt;/h3&gt;

&lt;p&gt;和以下参数有关(/etc/system):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;* set hard limit on file descriptors
set rlim_fd_max = 4096
* set soft limit on file descriptors
set rlim_fd_cur = 1024
&lt;/code&gt;&lt;/pre&gt;
</description>
      
    </item>
    
  </channel>
</rss>