Date: Sun, 21 Oct 2001 18:24:01 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <2593-Sun21Oct2001182401+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 In-reply-to: (message from Sami on Sun, 21 Oct 2001 14:29:13 GMT) Subject: Re: File attributes References: Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Newsgroups: comp.os.msdos.djgpp > From: Sami > Date: Sun, 21 Oct 2001 14:29:13 GMT > > By using chmod() I can set 'read-only' -file attribute like this: > > chmod ( "myfile", S_IWUSR | S_IRUSR ); > > I haven't found S_I* symbol for 'hidden' and 'system' -attributes. They aren't there: `chmod' is a Posix function, and Posix doesn't know anything about DOS/Windows-specific attributes. > Is there any standard (or any common) function or way in C to > set these -file attributes? I've found _chmod() in djgpp, but is there > a more common function for this? _chmod is your friend; there's no other function that supports these attributes. (You could, of course, use __dpmi_int to issue the relevant function of Int 21h, but that's even less portable.) > The purpose would be to have the source compiled in various > compilers. Borland has __chmod (two underscores). MSC probably has _chmod. I don't think you can get more portable than this. > Or are these attributes supported only under MS platforms? Yes, these attributes are DOS- and Windows-specific. They don't exist on Unix and GNU/Linux systems. > How this is done in C++? The same: call _chmod.