Silverfrost Logo About Us | Contact Us
 

DIRENT@

Platform

x64, Win32

Purpose

To obtain directory information.

Syntax

 SUBROUTINE DIRENT@(PAT, ATTRIBUTE, RESULT, RESULT_ATTRIBUTE, &
& RESULT_DATE, RESULT_TIME, FILE_SIZE, ERROR_CODE)
 CHARACTER (LEN=*) PAT,RESULT
 INTEGER (KIND= 2) ATTRIBUTE, RESULT_ATTRIBUTE,RESULT_DATE, &
&  RESULT_TIME,ERROR_CODE
 INTEGER (KIND=3) FILE_SIZE

Description

DIRENT@ returns directory information for files selected by PAT (e.g. A:\*.FOR). That is, each call of the routine searches for a single file in the directory and with the extension implied by PAT. The attribute of the first file returned is selected by setting ATTRIBUTE to one of the following values:

 

0

Return a normal file

 

2

Return a hidden file

 

4

Return a system file

 

6

Return a volume name

 

16

Return a sub directory

 

The name of the file that has been found is returned in RESULT. Other file information is returned in RESULT_ATTRIBUTE, RESULT_DATE, RESULT_TIME and FILE_SIZE. The file attributes are returned in DOS coded form using bits 0 to 5 of the result. The date and time are returned in DOS compressed format.
After the first call of the routine, ATTRIBUTE should be set to -1 in order to continue the search for another file with the same attribute as before. When no more files can be found, ERROR_CODE is returned with the corresponding system error code.

Notes

A sequence of calls to DIRENT@ with a given PAT must not be interrupted by a call to DIRENT@ with a different PAT.
The FILES@ routine has a simpler interface and is usually preferred to this routine.

Example

PROGRAM DIRENT
 CHARACTER (LEN=20)::PAT,FILE
 INTEGER (KIND=2)::ATTR,DATE,TIME,EC
 INTEGER (KIND=3)::SIZE
 CALL COUA@('Input directory pattern:')
 READ '(A)',PAT
 EC=0
 DO WHILE(EC == 0)
  CALL DIRENT@(PAT,0,FILE,ATTR,DATE,TIME,SIZE,EC)
  IF (EC == 0) PRINT '(A,I6,I6,I6,I6)',FILE, ATTR, DATE, TIME, SIZE
!Do not call DIRENT@(PAT2,...) from here
 END DO
END PROGRAM DIRENT

 

 

Copyright © 1999-2017 Silverfrost Limited