home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / msdos / programm / 8994 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.8 KB

  1. Path: sparky!uunet!psgrain!ee.und.ac.za!hippo!catpe!p0.f115.n7102.z5.fidonet.org!Jwf.Thirion
  2. From: Jwf.Thirion@p0.f115.n7102.z5.fidonet.org (Jwf Thirion)
  3. Sender: ufgate@catpe.alt.za (newsout1.26)
  4. Newsgroups: comp.os.msdos.programmer
  5. Subject: Re: How to change file attributes using Turbo C ??
  6. Message-ID: <2017.2AA50538@catpe.alt.za>
  7. Date: Tue, 01 Sep 92 20:20:01 GMT
  8. Organization: FidoNet node 5:7102/115.0 - Integrated Systems, CT
  9. Lines: 56
  10.  
  11. Well to change the file attributes, you can use inline assembly. The function
  12. is:
  13.  
  14. To call:
  15.  
  16. AH    <--- 43h
  17. AL    <--- 00h, Get file attributes
  18.            01h, Set file attributes
  19. CX    <--- New attribute (See bottom)
  20. DS:DX <--- Pointer to buffer
  21.  
  22. Returns:
  23.  
  24. Carry flag clear if successful
  25. CX = Attribute if get (See bottom)
  26.  
  27. Carry flah set if error
  28. AX = 01h, Invalid function (file sharing)
  29.      02h, File not found
  30.      03h, Path not found
  31.      04h, Access denied
  32.  
  33. 6543210  Meaning
  34. ......1  Read Only
  35. .....1.  Hidden
  36. ....1..  System
  37. .1.....  Archive
  38.  
  39. A sample Quick C function would probably be like this:
  40.  
  41. void SetFAttr (char *p)  /* Not sure how to use pointers, I am an ASM progr.)
  42. {
  43.  
  44. _asm {
  45. mov ah, 43h
  46. mov al, 01h
  47. mov cx, 03h       /* Make hidden and read only  (0000011b)
  48. push cs           /* May not   */ 
  49. pop ds            /* be needed */ 
  50. mov dx, p         /* Point to file */
  51. int 21h           /* Set attribute */
  52. }
  53. }
  54.  
  55. I dont know if the above will work, since I havn't tried it yet (too busy), but
  56. for know that should work. (I used it in one of my ASM programs). If you have 
  57. any trouble, i'll write you the functions in C. 
  58.  
  59. Cheers,
  60. JWF Thirion
  61.  
  62.  
  63. --  
  64. INTERNET: Jwf.Thirion@p0.f115.n7102.z5.fidonet.org
  65. via:  THE CATALYST BBS in Port Elizabeth, South Africa.
  66.        (catpe.alt.za)   +27-41-34-1122 HST or +27-41-34-2859, V32bis & HST.
  67.