* open or fopen?
@ 2006-05-18 8:15 Eric Fisher
2006-05-18 10:19 ` Ingo Krabbe
0 siblings, 1 reply; 2+ messages in thread
From: Eric Fisher @ 2006-05-18 8:15 UTC (permalink / raw)
To: gcc-help
hi,
There is a question about file operation functions used in gcc source
code. I can't figure out why sometimes we use open function such as
load_specs in gcc.c,
static char *
load_specs (const char *filename)
{
int desc;
...
/* Open and stat the file. */
desc = open (filename, O_RDONLY, 0);
...
}
why not fopen?
Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: open or fopen?
2006-05-18 8:15 open or fopen? Eric Fisher
@ 2006-05-18 10:19 ` Ingo Krabbe
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Krabbe @ 2006-05-18 10:19 UTC (permalink / raw)
To: gcc-help
Am Donnerstag, 18. Mai 2006 10:15 schrieb Eric Fisher:
> hi,
> There is a question about file operation functions used in gcc source
> code. I can't figure out why sometimes we use open function such as
> load_specs in gcc.c,
> static char *
> load_specs (const char *filename)
> {
> int desc;
> ...
> /* Open and stat the file. */
> desc = open (filename, O_RDONLY, 0);
> ...
> }
> why not fopen?
>
> Thanks
Sometimes it is easier to use open above fopen, when you need binary
transfers, though I doubt the correctness of this statement for the specs
file. But this might be a quite historic piece of code where we couldn't be
sure about the libc implementation that provides fopen.
Note that open should be available as a system call where fopen isn't
available, which is a library call (embedded systems ?!)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-18 10:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-18 8:15 open or fopen? Eric Fisher
2006-05-18 10:19 ` Ingo Krabbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).