open()和fopen() [英] open() and fopen()

查看:106
本文介绍了open()和fopen()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个功能有什么区别?谢谢。

解决方案

>这两个函数有什么区别?谢谢。


fopen()存在于标准C中.open()没有(除非

程序提供一个)。

Gordon L. Burditt


Gordon Burditt< go *********** @ burditt.orgwrote:
< blockquote class =post_quotes>


这两个函数有什么区别?谢谢。



fopen()存在于标准C中.open()不存在(除非

程序提供一个)。



我还要指出open()是一个POSIX函数。这组POSIX C

编程语言入口点不是主题,但

还有其他。例如,似乎comp.unix.programmer可能是
是一个更合适的组。


对于第一个近似值,这两者之间有一个合理的关系

函数可能是fopen()在open()上实现的

某些系统的open()可用。


-

Chris Smith - 首席软件开发人员/技术培训师

MindIQ Corporation


" Jack" ; < ju ****** @ gmail.comwrote:

#这两个函数有什么区别?谢谢。


fopen可以在任何托管的ANSI C系统上使用,并按照ANSI C运行。
.open的存在和语义取决于每个系统。


在Unix上,打开和相关的函数(如lseek,read,write)每个

导致跨保护边界转移到内核中

并且不要在流程的用户空间中使用提供缓冲。

fopen更便携,通常更高效。 open允许额外的非便携式操作。


-

SM Ryan http://www.rawbw.com/~wyrmwif/

猫王是艺术家。但这并没有阻止他在战争期间加入这项服务

。这就是为什么他是国王,你是个笨蛋。


What is the difference betweeb the two functions? Thanks.

解决方案

>What is the difference betweeb the two functions? Thanks.

fopen() exists in standard C. open() does not (unless the
program supplies one).

Gordon L. Burditt


Gordon Burditt <go***********@burditt.orgwrote:

What is the difference betweeb the two functions? Thanks.


fopen() exists in standard C. open() does not (unless the
program supplies one).

I''ll also point out that open() is a POSIX function. The set of POSIX C
programming language entry points is not on-topic for this group, but
there are others. For example, it appears that comp.unix.programmer may
be a more appropriate group.

For a first approximation, one reasonable relationship between these two
functions might be that fopen() is implemented in terms of open() on
some system for which open() is available.

--
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation


"Jack" <ju******@gmail.comwrote:
# What is the difference betweeb the two functions? Thanks.

fopen is available on any hosted ANSI C system and operates according
to ANSI C. The existence and semantics of open depend on each system.

On Unix, open and related function (such as lseek, read, write) each
results in a transfer across protection boundaries into the kernel
and do not use provide buffering in the user space of the process.
fopen is more portable and generally more efficient. open allows
additional, non-portable operations.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
Elvis was an artist. But that didn''t stop him from joining the service
in time of war. That''s why he is the king, and you''re a shmuck.


这篇关于open()和fopen()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆