[Mono-list] how to do chmod in C# program?
Mon, 19 Apr 2004 20:08:57 -0400
Thanks very much!!!! That's all I need!
----- Original Message -----
From: "Miguel de Icaza" <firstname.lastname@example.org>
To: "Peter Wolf" <email@example.com>
Sent: Monday, April 19, 2004 4:45 PM
Subject: Re: [Mono-list] how to do chmod in C# program?
> > 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.