[Mono-list] how to do chmod in C# program?

Peter Wolf p_wol@hotmail.com
Mon, 19 Apr 2004 20:08:57 -0400


Thanks very much!!!! That's all I need!

Peter
----- Original Message ----- 
From: "Miguel de Icaza" <miguel@ximian.com>
To: "Peter Wolf" <p_wol@hotmail.com>
Cc: <mono-list@lists.ximian.com>
Sent: Monday, April 19, 2004 4:45 PM
Subject: Re: [Mono-list] how to do chmod in C# program?


> Hello!
> 
> 
> > my program does this:  
> >  
> > FileStream file = new FileStream(blah-blah-blah);
> > file.Write(byteData, 0, byteData.Length);
> >  
> > The resulting file is always created with mode 100600 (owner: read,
> > write, others: nothing).
> >  
> > Is there any way to change the mode of this file to 100604 (to let
> > others read the file) within my C# application?
> 
> You can use Mono.Posix:
> 
> using Mono.Posix;
> 
> ...
> Syscall.chmod ("file", (FileMode) hex_value);
> 
> Notice that you should use an hex-value with the current release of
> Mono, as we shipped with wrong FileMode values.
>