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

Re: [MacPerl] sysopen



On 7/12/99 at 2:37 PM, Paul J. Schinder wrote:

: On Mon, Jul 12, 1999 at 01:57:26PM -0400, Chris Nandor wrote:
: } What am I missing (if anything)?
: } 
: }   #!perl -wl
: }   use Fcntl;
: }   sysopen FILE, "foo", O_RDWR|O_TRUNC|O_CREAT or die $!;
: }   print FILE "ha!";
: }   close FILE;
: 
: The problem seems to be that O_RDWR has the wrong value.  When I print
: it out, I get 0 instead of the expected (from /usr/include/asm/fcntl.h
: on m LinuxPPC R4 machine) 2.  When I replace O_RDWR with 0x2 on the
: only Mac I have running MacOS at the moment, my Powerbook running
: 5.20r4, MacOS 7.6.1, your script works.  Otherwise it fails just like
: it does for you.  (The script works under LinuxPPC.)  Check the
: CodeWarrior headers and see what they have.  0 is the read-only value.
: 


CodeWarrior (Pro4) defines the following (in fcntl.mac.h):

#define O_RDWR          0x1         /* open the file in read/write mode */
#define O_RDONLY        0x2         /* open the file in read only mode  */
#define O_WRONLY        0x4         /* open the file in write only mode */
#define O_APPEND        0x0100      /* open the file in append mode */
#define O_CREAT         0x0200      /* create the file if it doesn't exist */
#define O_EXCL          0x0400      /* if the file already exists don't create it
again */
#define O_TRUNC         0x0800      /* truncate the file after opening it */
#define O_NRESOLVE      0x1000      /* Don't resolve any aliases */
#define O_ALIAS         0x2000      /* Open alias file (if the file is an alias)
*/
#define O_RSRC          0x4000      /* Open the resource fork */
#define O_BINARY        0x8000      /* open the file in binary mode (default is
text mode) */


This note was from the MSL 2.4 release notes in CWPro3:   
*  MW00042
   On Mac, O_RDWR mode for fopen incorrectly sets value to 0x0


Don't know what the reason for this is.

Don



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org