Re: [hackers] FILE vs fd

From: Martti Kühne <mysatyre_AT_gmail.com>
Date: Sat, 13 Jun 2015 07:13:43 +0200

On Sat, Jun 13, 2015 at 6:36 AM, Aditya Goturu <aditya3098_AT_gmail.com> wrote:
> Is there any particular reason why I would use unix's fd and open()
> instead of ANSI's FILE struct and fopen()?


FILE is generally easier to use and provides application-centric
interfaces such as the setbuf() family of functions. The FILE
interface and its accessor functions are defined by the C standard and
every C standard library is generally expected to implement these.
The other is defined by POSIX and provides more fine grained control
eg. with fcntl.

That said, I find the question silly and would like to know whether
you learned any program outside of youtube, like, with documentation
with written words. Both these things have a clear definition and
justification and the standard library actually implements one on top
of the other. I leave it up to you to decide which order applies,
because you were intelligent enough at the time when you subscribed to
this mailing list.

cheers!
ma77i
Received on Sat Jun 13 2015 - 07:13:43 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:36:52 CEST