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

[MacPerl] O_RDWR | O_CREAT



At 11:28 -0700 98/06/12, Brian "L." Matthews wrote:
> Jeremy Lee writes:
> |What are
> |     O_RDWR | O_CREAT
>
> They symbolically specify the mode the file is to be opened in. In this
> case, O_RDWR means to open the file for reading and writing, and O_CREAT
> says to create the file if it doesn't exist.

At 13:09 -0500 98/06/12, Mark Manning/Simulacron I wrote:
> O_RDWR and O_CREAT are from C.  Under Unix (and probably other OSs too)
> there are certain commands which you can use to read from, write to, or
> append information onto files.  On the Silicon Graphics Inc. (SGI)
> computers using SGI's Unix variant you have:

Or as pertains to Perl:  On a Unix machine, under C, these are all #defined
to various values in the include file <sys/fcntl.h> and are then used as
flags to calls such as open().

Under Perl, the Fcntl.pm module is used to load the appropriate definitions
into these O_* "constants".  i.e.:

      "This module is just a translation of the C <fnctl.h> file."

So they work like their Unix C counterparts but they are not the same sort
of beastie as their C counterparts. Chris told me at one point that these
are inline subroutines (they could (should?) technically be called as
    O_RDWR() | O_CREAT()
but the syntax is to give a "C look and feel".

I can't find sub declarations.  Are they subs?  Or something else?

I'm coming at these from a different prespective.  I know C (under Unix,
Jeff, only under Unix :-) But this is a Mac and I don't have any C include
files or any of that header environment installed, so, how does this work?
Since there is no sys/fcntl.h on a Mac, I'd really appreciate some brief
explanation of how these actually get set / are implemented under MacPerl.
I'm getting a little confused trying to track through the code...

-V
---
Vicki Brown, vlb@cfcl.com        |\      _,,,---,,_
Journeyman Sourceror      ZZZzz /,`.-'`'    -.  ;-;;,_
Scripts & Philtres             |,4-  ) )-,_. ,\ (  `'-'
http://www.cfcl.com/~vlb      '---''(_/--'  `-'\_)
P.O. Box 1269 San Bruno, CA  94066

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch