<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://www.gentoo-zh.org/extern.php?action=feed&amp;tid=406&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Gentoo中文社区 / C 练习实例97]]></title>
		<link>https://www.gentoo-zh.org/viewtopic.php?id=406</link>
		<description><![CDATA[C 练习实例97 最近发表的帖子。]]></description>
		<lastBuildDate>Mon, 29 Aug 2022 11:57:05 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[C 练习实例97]]></title>
			<link>https://www.gentoo-zh.org/viewtopic.php?pid=412#p412</link>
			<description><![CDATA[<p>题目：从键盘输入一些字符，逐个把它们送到磁盘上去，直到输入一个#为止。</p><p>程序分析：无。</p><div class="codebox"><pre><code>#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;
int main()
{
    FILE*fp=NULL;
    char filename[25];
    char ch;
    printf(&quot;输入你要保存到的文件的名称：\n&quot;);
    gets(filename);
    if((fp=fopen(filename,&quot;w&quot;))==NULL)
    {
        printf(&quot;error: cannot open file!\n&quot;);
        exit(0);
    }
    printf(&quot;现在你可以输入你要保存的一些字符，以#结束：\n&quot;);
    getchar();
    while((ch=getchar())!=&#039;#&#039;){
        fputc(ch,fp);
    }
    fclose(fp);
    system(&quot;pause&quot;);
    return 0;
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (batsom)]]></author>
			<pubDate>Mon, 29 Aug 2022 11:57:05 +0000</pubDate>
			<guid>https://www.gentoo-zh.org/viewtopic.php?pid=412#p412</guid>
		</item>
	</channel>
</rss>
