www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/21/12:29:51

Date: Sun, 21 Oct 2001 18:24:01 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
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: <Xns9141B245048B1gd678bcz5bAA@192.89.123.233> (message from Sami
on Sun, 21 Oct 2001 14:29:13 GMT)
Subject: Re: File attributes
References: <Xns9141B245048B1gd678bcz5bAA AT 192 DOT 89 DOT 123 DOT 233>
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

> Newsgroups: comp.os.msdos.djgpp
> From: Sami <no AT spam DOT com>
> 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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019