home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psgrain!ee.und.ac.za!hippo!catpe!p0.f115.n7102.z5.fidonet.org!Jwf.Thirion
- From: Jwf.Thirion@p0.f115.n7102.z5.fidonet.org (Jwf Thirion)
- Sender: ufgate@catpe.alt.za (newsout1.26)
- Newsgroups: comp.os.msdos.programmer
- Subject: Re: How to change file attributes using Turbo C ??
- Message-ID: <2017.2AA50538@catpe.alt.za>
- Date: Tue, 01 Sep 92 20:20:01 GMT
- Organization: FidoNet node 5:7102/115.0 - Integrated Systems, CT
- Lines: 56
-
- Well to change the file attributes, you can use inline assembly. The function
- is:
-
- To call:
-
- AH <--- 43h
- AL <--- 00h, Get file attributes
- 01h, Set file attributes
- CX <--- New attribute (See bottom)
- DS:DX <--- Pointer to buffer
-
- Returns:
-
- Carry flag clear if successful
- CX = Attribute if get (See bottom)
-
- Carry flah set if error
- AX = 01h, Invalid function (file sharing)
- 02h, File not found
- 03h, Path not found
- 04h, Access denied
-
- 6543210 Meaning
- ......1 Read Only
- .....1. Hidden
- ....1.. System
- .1..... Archive
-
- A sample Quick C function would probably be like this:
-
- void SetFAttr (char *p) /* Not sure how to use pointers, I am an ASM progr.)
- {
-
- _asm {
- mov ah, 43h
- mov al, 01h
- mov cx, 03h /* Make hidden and read only (0000011b)
- push cs /* May not */
- pop ds /* be needed */
- mov dx, p /* Point to file */
- int 21h /* Set attribute */
- }
- }
-
- I dont know if the above will work, since I havn't tried it yet (too busy), but
- for know that should work. (I used it in one of my ASM programs). If you have
- any trouble, i'll write you the functions in C.
-
- Cheers,
- JWF Thirion
-
-
- --
- INTERNET: Jwf.Thirion@p0.f115.n7102.z5.fidonet.org
- via: THE CATALYST BBS in Port Elizabeth, South Africa.
- (catpe.alt.za) +27-41-34-1122 HST or +27-41-34-2859, V32bis & HST.
-