<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ubuntu,debian,redhat -linuxany.com &#187; fopen</title>
	<atom:link href="http://www.linuxany.com/archives/tag/fopen/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxany.com</link>
	<description></description>
	<lastBuildDate>Thu, 26 Jan 2012 08:59:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>fopen和open的具体区别</title>
		<link>http://www.linuxany.com/archives/902.html</link>
		<comments>http://www.linuxany.com/archives/902.html#comments</comments>
		<pubDate>Wed, 11 Nov 2009 06:15:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[fopen]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[strcpy]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=902</guid>
		<description><![CDATA[1、open 是系统调用 返回的是文件句柄，文件的句柄是文件在文件描述副表里的索引，fopen是C的库函数，返回的是一个指向文件结构的指针。 2、fopen的实现要调用open， 关键看你想返回什么了， FILE指针还是描述符？ 3、32位环境下，编译加“-D_FILE_OFFSET_BITS=64” 要在open里加O_LARGEFILE标记 static int ext2_open_file (struct inode * inode, struct file * filp) { if&#160;(!(filp-&#62;f_flags &#38; O_LARGEFILE) &#38;&#38; &#160; &#160; &#160;&#160; inode-&#62;i_size &#62; 0x7FFFFFFFLL) return -EFBIG; return&#160;0; } 0x7FFFFFFF就是2G-1。 看一下这个逻辑， 就知道open时必须制定O_LARGEFILE. 4、fopen一个文件,fclose两次,会是什么样的情况? 测试了一下: 在aix,hp,sco,unixware上fclose第一次成功,fclose第二次返回错误 在linux上.fclose第一次成功,第二次报segmentation fault,程序段错误 5、计算机语言遵循的规范称为标准。C语言有C标准，C++语言有C++标准。标准中详细规定了你能够做什么和不能做什么。标准中规定不能做的就是我说的标准的禁止事项。 其实不只是标准，在介绍学习或使用语言的书中也会出现大量的应该做和不应该做的说明，只是一般不可能象标准那样全面。所以，在“The C Programming Language”中没有提到这个未定义行为也没有什么奇怪的。 “程序员基本职责”？……　可以认为是为了实现程序预定的目的，对程序员的基本要求。在使用语言上的一个基本要求就是要符合标准规定。 >> 还有一个问题 >> 在非linux系统下,我使用fopen打开的文件 >> 使用close关闭(注意,不是fclose),缓冲也相应关闭; >> [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/902.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C中的文件操作</title>
		<link>http://www.linuxany.com/archives/882.html</link>
		<comments>http://www.linuxany.com/archives/882.html#comments</comments>
		<pubDate>Sun, 01 Nov 2009 01:11:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[fclose]]></category>
		<category><![CDATA[fopen]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=882</guid>
		<description><![CDATA[文件使用方式 　　　　　　　意 义 “rt”　　　　　　只读打开一个文本文件，只允许读数据 “wt”　　　　　　只写打开或建立一个文本文件，只允许写数据 “at”　　　　　　追加打开一个文本文件，并在文件末尾写数据 “rb”　　　　　　只读打开一个二进制文件，只允许读数据 “wb”　　　　 　 只写打开或建立一个二进制文件，只允许写数据 “ab” 　　　　 　追加打开一个二进制文件，并在文件末尾写数据 “rt+”　　　　　 读写打开一个文本文件，允许读和写 “wt+”　　　　　 读写打开或建立一个文本文件，允许读写 “at+”　　　　　 读写打开一个文本文件，允许读，或在文件末追加数 据 “rb+”　　　　　 读写打开一个二进制文件，允许读和写 “wb+”　　　　　 读写打开或建立一个二进制文件，允许读和写 “ab+” 　　　　　读写打开一个二进制文件，允许读，或在文件末追加数据 在C语言中提供了多种文件读写的函数： ·字符读写函数 ：fgetc和fputc ·字符串读写函数：fgets和fputs ·数据块读写函数：freed和fwrite ·格式化读写函数：fscanf和fprinf 起始点 　　　表示符号 　　　数字表示 ────────────────────────── 文件首 　　　SEEK—SET　　　　0 当前位置 　　SEEK—CUR　　　　1 文件末尾 　　SEEK—END 　　　 2 您还可能感兴趣的内容在vim/vi中快速执行php或c/c++的方法fopen和open的具体区别sprintf()的一些高级用法 使用 inotify 监控文件系统的活动使用 inotify 监控 Linux 文件系统事件]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/882.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

