#: 10503 S12/OS9/68000 (OSK)
28-Apr-91 22:34:54
Sb: #creat() help
Fm: Bob van der Poel 76510,2203
To: all
Is it possible to set the file attributes when using creat()?
If I do something like creat(filename,S_IREAD+S_IOREAD) I get a "illegal mode"
error. I've tried various combinations, but the only ones which seem to take
are S_IREAD, S_IWRITE and S_ISHARE. Trying to set any public bits causes
errors. I'm beginning to think that creat() will always set the file
permissions to S_IREAD+S_IWRITE and uses the 'mode' param as the access mode
when opening the file. But this is not what the docs imply. I know I can use
create() to do what I want, but this has really got me bugged. I see that there
is a mask defined in the modes.h file, but I really don't understand what to do
with it. This is probably really simple and I'll feel stupid (again) once
someone points out the answer....
Oh, I tried this under Level II and it seems that the file is always created
for public read and owner read/write, no matter what the value of 'mode'. No
errors, but mode doesn't seem to have much effect either.
There are 2 Replies.
|