Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Display a listing of files.

Syntax

DIR [<xcFileSpec>]

Arguments

<xcFileSpec>The file specification for the directory search.  Besides a file name, this specification may also include an optional drive, directory, and extension.  The file name and extension may include the standard wildcard characters (* and ?).  If you do not specify a drive and directory, this function respects SetDefault().
 
If the argument is omitted, the default file specification is *.DBF.
 
If <xcFileSpec> is not specified, the listing includes the file name, date of last update, and number of records.  Otherwise, it includes the file name, extension, number of bytes, and date of last update.

Notes

To save the directory listing in an array, use Directory() instead of Dir().

Examples

This example displays all files, all database files, and all text files in the current directory:

 

cFilespec := "*.*"
DIR (cFilespec)                // Display all files
DIR                                        // Display all .dbf files
DIR *.txt                                // Display all text files

Assembly

XSharp.RT.DLL

See Also

ADir(), Directory(), SetDefault()