setting mode using creat function prob!
4 posters
setting mode using creat function prob!
i got a problem in setting mode to the files created by the creat() function!
if we create a new file which does not exist already using the create command we are not able to set the correct rights correctly
i gave creat("newfile",0777);
but the ls -l newfile command showed me -rwxrwxr-x
if i give the option as 0000 its working normally! i mean i got ---------- as the rights
if we create a new file which does not exist already using the create command we are not able to set the correct rights correctly
i gave creat("newfile",0777);
but the ls -l newfile command showed me -rwxrwxr-x
if i give the option as 0000 its working normally! i mean i got ---------- as the rights
Re: setting mode using creat function prob!
I too hav d same problem.......
urvershi- Posts : 21
Points : 70
Join date : 2010-02-26
Re: setting mode using creat function prob!
That is caused by umask! By default the umask is set to 002 in our home directory.To allow write permission for others,make the umask to 000.So before creating the file, use umask(0) and then create the file.This will ensure the file permission is rwx for owner,group and others.
Google umask to read more about it.
And enter umask at $ prompt.You will get the value as 0002
Google umask to read more about it.
And enter umask at $ prompt.You will get the value as 0002
Maithreyi- Posts : 76
Points : 142
Join date : 2010-03-03
Age : 36
Location : Haldia
Permissions in this forum:
You cannot reply to topics in this forum
|
|