Silverfrost Forums

Welcome to our forums

Reading DOS compressed file attributes

7 Sep 2004 8:57 #54

Summary

Certain ClearWin+ functions, including FILES@, return file attribute information encoded in a single integer(kind=2).

Solution

Specific bits of this integer indicate various file attributes. These can be checked individually by using the iand intrinsic as in the following example:

if (iand(attr(1), FILE_ATTRIBUTE_DIRECTORY) > 0) print *, ' directory'
if (iand(attr(1), FILE_ATTRIBUTE_HIDDEN) > 0) print *, ' hidden'
if (iand(attr(1), FILE_ATTRIBUTE_NORMAL) > 0) print *, ' normal'
if (iand(attr(1), FILE_ATTRIBUTE_READONLY) > 0) print *, ' read only'
if (iand(attr(1), FILE_ATTRIBUTE_SYSTEM) > 0) print *, ' system'
if (iand(attr(1), FILE_ATTRIBUTE_TEMPORARY) > 0) print *, ' temporary'

In this example attr is an integer(kind=2) array returned from FILES@.

You need to include 'win32prm.ins' (or use msw32prm if you prefer modules) in your program for the definitions of FILE_ATTRIBUTE_* to be present.


-- Admin Silverfrost Limited
This forum is locked.