Re: How to control permission of file?



On 2006-06-30, K.S.Sreeram <sreeram@xxxxxxxxxxxxxxx> wrote:
Grant Edwards wrote:
When one open()s a file (that doesn't exist) for writing , how
does one control that file's permissions (it's "mode" in Unix
terms).

Check out 'os.open'
It returns a file descriptor, and if you need a file object you can use
'os.fdopen' on the file descriptor

Thanks. I thought maybe there was a less arcane way to do it.

--
Grant Edwards grante Yow! FROZEN ENTREES may
at be flung by members of
visi.com opposing SWANSON SECTS...
.



Relevant Pages

  • Re: get FILE* from Tcl_Channel
    ... rene writes: ... On unix that returns a file descriptor (ie what you get from ... MacOSX probably uses the unix stuff. ... rot13 the return address or read the X-Address header. ...
    (comp.lang.tcl)
  • Re: Unix I/O and C library I/O, why there are two sets of I/O functions?
    ... But another set of I/O functions are also defined in Unix, for example, ... is that the posix functions operate with a file descriptor, ... you could save a document and type in ".sound" as the ...
    (comp.lang.c)
  • Re: Setting the length of a file
    ... I want my code to work in both Unix and Windows; ... _fileno- returns the file descriptor of an open stream. ... _chsize- changes the size of an open file, given a file descriptor. ...
    (comp.lang.c)
  • Re: write() and send() or sendto() ?
    ... >>selectin Winsock works like the Unix selectas long as it is being ... >>anything else but sockets. ... >>on any file descriptor. ... e.g. file descriptors for device files when the driver for that ...
    (comp.unix.programmer)
  • Re: Unix I/O and C library I/O, why there are two sets of I/O functions?
    ... But another set of I/O functions are also defined in Unix, for example, ... open, close, read, write, lseek() ... ... One issue that hasn't been addressed so far is that the posix functions operate with a file descriptor, which can refer to things other than files. ...
    (comp.lang.c)