Mail Archives: djgpp/2001/10/21/12:29:51
> 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 -