fopen和open的区别

int open (const char *pathname, int flags, mode_t mode);
FILE *fopen (const char *path, const char *mode);

前者属于低级IO,后者是高级IO。
前者返回一个文件描述符,后者返回一个文件指针。
前者无缓冲,后者有缓冲。
前者与 read, write 等配合使用, 后者与 fread, fwrite等配合使用。
后者是在前者的基础上扩充而来的,在大多数情况下,用后者。

posted @ 2012-09-26 21:39  hellomsg  阅读(252)  评论(0编辑  收藏  举报