File
文章平均质量分 80
lamdoc
这个作者很懒,什么都没留下…
展开
-
文件操作函数_open_close_llseek_read_write
1. open(): 这函数有2个原型: #include #include #include/*此头文件里面定义了mode标志*/ int open(const char *path, int oflags); int open(const char *path, int oflags, mode_t mode);函数描述:open建立了一条到文件或设备的访问路径。如果操作成功,它将原创 2013-02-22 17:27:37 · 394 阅读 · 0 评论 -
readb(), readw(), readl(),writeb(), writew(), writel() 宏函数
1. readb(), readw(), readl() 函数 功能: 从内存映射的 I/O 空间读取数据。 readb 从 I/O 读取 8 位数据 ( 1 字节 );readw 从 I/O 读取 16 位数据 ( 2 字节 );readl 从 I/O 读取 32 位数据 ( 4 字节 )。 原型: #include unsigned char readb(unsign原创 2012-12-05 10:12:55 · 941 阅读 · 0 评论 -
open和fopen的区别:
1.缓冲文件系统 缓冲文件系统的特点是:在内存开辟一个“缓冲区”,为程序中的每一个文件使用,当执行读文件的操作时,从磁盘文件将数据先读入内存“缓冲区”, 装满后再从内存“缓冲区”依此读入接收的变量。执行写文件的操作时,先将数据写入内存“缓冲区”,待内存“缓冲区”装满后再写入文件。由此可以看出,内存 “缓冲区”的大小,影响着实际操作外存的次数,内存“缓冲区”越大,则操作外存的次数就少,执行速度就快转载 2013-02-22 17:13:15 · 264 阅读 · 0 评论 -
dirent_DIR and opendir()_readdir()_rewinddir()_telldir_seekdir()_closedir()
1. dirent --- 用来表示某文件夹的目录内容。 我猜是directory content 的缩写. dirent 定义于 /include/bits/dirent.h 中: struct dirent { #ifndef __USE_FILE_OFFSET64 __ino_t d_ino; __off_t d_off; #else原创 2013-01-28 11:20:25 · 718 阅读 · 0 评论 -
stat---文件状态信息结构体
1. stat 结构体用来表示相关文件状态信息。 stat 结构题定义于个体系架构下的 stat.h 文件中, 如x86下,是 arch/x86/include/asm/stat.h arm下, 是 arch/arm/include/asm/stat.h, 下面以x86为例,stat 结构题的定义: struct stat { unsigned long st原创 2013-01-28 10:19:13 · 521 阅读 · 0 评论 -
fileno(FILE)
函数原型: int fileno( FILE *stream );函数功能:fileno()用来取得参数stream指定的文件流所使用的文件描述符 返回值:某个数据流的文件描述符 头文件:stdio.h 相关函数:open,fopen,fclose 例子: #include int main( void ) { printf( "The file descripto原创 2013-04-15 13:59:33 · 391 阅读 · 0 评论 -
文件操作函数_fopen_fclose_fread_fwrite_fseek_fputc_fgetc_ftell_fgetpos_fsetpos_ungetc_fflush_setvbuf
1. C语言文件操作分为两类,分为 文本文件操作 和二进制文件操作。 头文件是: #include 2. fopen() 函数: FILE *fopen(const char *path, const char *mode); 返回值:文件顺利打开后,指向该流的文件指针就会被返回。如果文件打开失败则返回NULL,并把错误代码存在errno 中。 一般而言,打开文件后会作一些原创 2012-12-03 22:22:29 · 833 阅读 · 0 评论