Re: open or fopen?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ?!)

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux