home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / FLRETATR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  1007 b   |  46 lines

  1. /**
  2. *
  3. * Name        flretatr -- Return file attribute
  4. *
  5. * Synopsis    ercode = flretatr(pfile,pattrib);
  6. *
  7. *        int  ercode      Returned DOS function error code
  8. *        char *pfile      File path name
  9. *        int  pattrib      Returned file attribute
  10. *
  11. * Description    This function returns the file attribute of the
  12. *        specified file.  See FLCREATE for the possible
  13. *        attributes.
  14. *
  15. * Returns    ercode          DOS 2.0 function return error code
  16. *        *pattrib      File attribute.  If an error is encountered
  17. *                  -1 is returned.
  18. *
  19. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  20. *
  21. **/
  22.  
  23. #include <bfile.h>
  24.  
  25. int flretatr(pfile,pattrib)
  26. char *pfile;
  27. int  *pattrib;
  28. {
  29.     DOSREG dos_reg;
  30.     int    ercode;
  31.     ADS    file_ads;
  32.  
  33.     dos_reg.ax = 0x4300;
  34.     utabsptr(pfile,&file_ads);
  35.     dos_reg.ds = file_ads.s;
  36.     dos_reg.dx = file_ads.r;
  37.  
  38.     ercode     = dos(&dos_reg);
  39.     if (ercode == 0)
  40.        *pattrib = (int)dos_reg.cx;
  41.     else
  42.        *pattrib = -1;
  43.  
  44.     return(ercode);
  45. }
  46.