GINO Graphics Suite - GINO v9.0  

gGetFullDirList

Syntax

[C/C++:]
int gGetFullDirList(char pattern[], int *n, char *names[], int types[],  int dates[], int sizes[], int flen);
[F90:]
integer function gGetFullDirList(pattern, n, names, types, dates, sizes)

character*(*), intent(in) :: pattern
integer, intent(inout) :: n
character*(*), intent(out) :: names(*)
integer, intent(out) :: types(*),dates(*),sizes(*)

Arguments

pattern
File search pattern

n
Input - Size of attribute arrays (No. of files required) Output - Number of entries in attribute arrays (No. of files returned)

names
List of file names

types
List of file types

dates
List of file creation/modification dates (packed)

sizes
List of file sizes (in bytes)

flen
Maximum length of filename including terminating NULL (C/C++ only)

Description

The function gGetFullDirList() returns the names of the files and their attributes that match the file search pattern passed in the character string pattern. pattern may contain any legal search pattern containing directory name and/or wild characters that are permitted in the implementation being used. If pattern is a blank string, all files in the current directory are treated as matching the pattern. The input value of the argument n specifies the maximum number of files to be returned (ie. indicating the size of the return arrays names, types, dates and sizes), but on return, n will be set to the actual number of files returned which may be less than or equal to the input value.

In the C/C++ binding, space must be allocated for the required number of file names prior to calling this function. This is achieved by declaring an array of length n of character pointers (the address of which is passed to this function) and allocating space for each file name using malloc, the address of which is placed in the character array. The space allocated for each file name should be equal to flen * sizeof(char). In both bindings, if the individual file names are larger than the width of the character array, the names will be truncated.

The list of file names is returned in names, each being a simple name without preceding directory name. Their associated file types and sizes are returned in the corresponding elements of the types, dates and sizes arrays. Each entry of the types array contains a bit pattern representing the following information about the file:

Bit      Information
1        Read-only
2        Hidden
3        System
4        Archive
5        Directory


Thus if the types element =0 , the corresponding file is a normal file, but if the element contains 17, the file is a read-only directory etc.

Each element in the dates array contains an integer value representing the date and/or time the corresponding file was last modified or created. The value is in an implementation dependent format and should only be used for sorting purposes without unpacking. The system utility routine gReturnDirDate() can be used to unpack the date and time information into its separate components.

The routine returns a non zero value if the operation was not successful for any reason and zero if successful.

See Also

gGetFullDirList Usage
gReturnDirDate
gGetDirList