BXX() Draws a box on the screen of a given color



  <nTop >      - top row
  <nLeft>      - left col
  <nBottom>    - bottom row
  <nRight>     - right column
  [nColor]     - attribute to box default setcolor()
  [nShadow]    - numeric shadow type  (default 0)
                        follow numeric keypad
                            7 = upper left
                            1 = lower left
                            3 = lower right
                            9 = upper right
                            0 = no shadow

  [nShadowColor] - shadow attribute (default 7 - grey
  on black)

  [cFrame ] - frame string - MUST be 9 characters -
  default single line

   BXX(10,10,20,20,47,9,8,"+-+|+-+| ")



ADir() Function


Fill a series of arrays with directory information
Syntax :

ADIR( [<cFilespec>],
      [<aAttributes>]) --> nFiles

Arguments :

<cFilespec> is the path specification of files to include in the scan of the DEFAULT directory. It is a standard file specification that can include the wildcard characters * and ?, as well as a drive and path reference. If omitted, the default specification is *.*.

<aFilenames> is the array to fill with the file names matching <cFilespec>. Each element contains the file name and extension as a character string in all uppercase letters.

<aSizes> is the array to fill with the sizes of the corresponding files in the <aFilenames> array. Each element is a numeric data type.

<aDates> is the array to fill with the dates of the corresponding files in the <aFilenames> array. Each element is a date data type.

<aTimes> is the array to fill with the times of the corresponding files in the <aFilenames> array. Each element filled contains a character string of the form: hh:mm:ss.

<aAttributes> is the array to fill with attributes of the corresponding files in the <aFilenames> array. Each element is a character string. If <aAttributes> is specified, hidden, system, and directory files are included as well as normal files. If <aAttributes> is not specified, only normal files are included.

Returns :

ADIR() returns the number of files matching the directory skeleton described in <cFilespec>.

Description :

ADIR() is an array function that performs two basic operations. First, it returns the number of files matching the file specification. Second, it fills a series of arrays with file names, sizes, dates, times, and attributes.

ADIR() is a compatibility function and therefore not recommended. It is superseded by the DIRECTORY() function which returns all file information in a multidimensional array.

Notes :

Directories: If you specify the <aAttributes> argument and <cFilespec> is *.*, directories will be included in <aFilenames>. In the <aAttributes> array, directories are indicated with an attribute value of “D”. If ADIR() is executed within a subdirectory, the first two entries of the <aFilenames> array are “.” and “..”, the parent and current directory aliases. The date and time of last update are reported for directories, but the size of a directory is always zero.

Examples :

This example creates an array to hold the names of all .txt files in the current DEFAULT directory, then uses AEVAL() to list them to the console:

 LOCAL aFiles[ADIR("*.TXT")]
 ADIR("*.TXT", aFiles)
 AEVAL(aFiles, { |element| QOUT(element) } )

Remarks :

ADIR() is an obsolete function with some drawbacks.

– Requires five separate arrays for each file specification : name, size, date, time and attrribute.

– Each of these array must be length of exact file count. Return value of function is number of files, so you need call this function twice : first for obtain number of files and second for actual file info.

– Including directories is depend of existence of <aAttributes>, and <aAttributes> require been length of exact file count.

So if you want to see directories you need call this function triple ( see below sample ).

As a result, as indicated in “Description” above, using DIRECTORY() instead of ADIR() may be more convenient.


PROC Main()
LOCAL cFileSpec := "C:\hb32\*.*"
LOCAL aFileNames := ARRAY( ADIR( cFileSpec ) )
LOCAL nFileCount := LEN( aFileNames )
LOCAL aFileSizes := ARRAY( nFileCount ),;
      aFileDates := ARRAY( nFileCount ),;
      aFileTimes := ARRAY( nFileCount ),;
      aFileAttrb := ARRAY( nFileCount )
LOCAL nMaxFNmLen := 0
nFileCount := ADIR( cFileSpec, aFileNames, aFileSizes,;
                    aFileDates, aFileTimes, aFileAttrb )
ASIZE( aFileNames, nFileCount )
ASIZE( aFileSizes, nFileCount )
ASIZE( aFileDates, nFileCount )
ASIZE( aFileTimes, nFileCount )
ASIZE( aFileAttrb, nFileCount )
ADIR( cFileSpec, aFileNames, aFileSizes, aFileDates,;
                 aFileTimes, aFileAttrb )
AEVAL( aFileNames, { | c1FName | nMaxFNmLen := ;
                      MAX( nMaxFNmLen, LEN( c1FName ) ) } )
AEVAL( aFileNames, { | c1FName, i1 | ;
                       QOUT( PADR( c1FName, nMaxFNmLen + 1 ),;
                       TRAN( aFileSizes[ i1 ], "999,999,999" ),;
                             aFileDates[ i1 ],;
                             aFileTimes[ i1 ],;
                             aFileAttrb[ i1] ) } )
WAIT "End of ADIR.prg"
RETU // ADir.Main()


Result of ADIR.prg :
 .                   0  13.09.2012 02:07:15 D
 ..                  0  13.09.2012 02:07:15 D
 addons              0  13.09.2012 02:07:07 D
 bin                 0  13.09.2012 02:07:12 D
 ChangeLog   8,848,829  12.09.2012 01:59:44 A
 comp                0  13.09.2012 02:07:12 D
 contrib             0  13.09.2012 02:07:16 D
 COPYING        47,456  12.09.2012 01:59:44 A
 doc                 0  13.09.2012 02:07:07 D
 extras              0  13.09.2012 02:07:15 D
 include             0  13.09.2012 02:07:07 D
 INSTALL        79,968  12.09.2012 01:59:44 A
 lib                 0  13.09.2012 02:07:14 D
 NEWS          108,058  12.09.2012 01:59:44 A
 RELNOTES        9,832  18.04.2012 04:00:10 A
 tests               0  13.09.2012 02:07:15 D
 TODO            2,924  12.09.2012 01:59:44 A
 uninstall.exe 104,646  13.09.2012 02:07:12 A
End of ADIR.prg


Database Terms

Alias :

The name of a work area; an alternate name given to a database file. Aliases are often used to give database files descriptive names and are assigned when the database file is opened. If no alias is specified when the database file is USEd, the name of the database file becomes the alias.

An alias can be used to reference both fields and expressions (including user-defined functions). In order to alias an expression, the expression must be enclosed in parentheses.

See also : Work Area

Attribute :

As a formal DBMS term, refers to a column or field in a table or database file.

See Also: Column, Field

Beginning of File :

The top of the database file. In Clipper language there is no beginning of file area or record. Instead, it is indicated by BOF() returning true (.T.) if an attempt is made to move the record pointer above the first record in the database file or the database file is empty.

Cell :

In a table, a cell is the intersection of a Row and a Column.

Column :

A database term used to describe a field in a table or database file.

See Also: Field

Concurrency :

The degree to which data can be accessed by more than one user at the same time.

Condition :

A logical expression that determines whether an operation will take place. With database commands, a logical expression that determines what records are included in an operation. Conditions are specified as arguments of the FOR or WHILE clause.

See Also: Scope

Controlling/Master Index :

The index currently being used to refer to records by key value or sequential record movement commands.

See Also: Index, Natural Order

Database :

An aggregation of related operational data used by an application system. A database can contain one or more data files or tables.

See Also: Field, Record, Tuple, View


An acronym for the term database management system. A DBMS is a software system that mediates access to a database through a data manipulation language.

Delimited File :

A text file that contains variable-length database records with each record separated by a carriage return/linefeed pair (CHR(13) + CHR(10)) and terminated with an end of file mark (CHR(26)). Each field within a delimited file is variable length, not padded with either leading or trailing spaces, and separated by a comma. Character strings are optionally delimited to allow for embedded commas.

End of File :

The bottom of a database file. In Clipper language, this is LASTREC() + 1 and is indicated by EOF() returning true (.T.).

Field :

The basic column unit of a database file. A field has four attributes: name, type, length, and decimals if the type is numeric.

See Also: Database, Record, Tuple, Vector, View

Field Variable :

A variable that refers to data in a database field, as opposed to data in memory.

See Also: Local Variable, Memory Variable, Variable

Index :

An ordered set of key values that provides a logical ordering of the records in an associated database file. Each key in an index is associated with a particular record in the database file. The records can be processed sequentially in key order, and any record can be located by performing a SEEK operation with the associated key value.

See Also: Controlling/Master Index, Key Value, Natural Order

Join :

An operation that takes two tables as operands and produces one table as a result. It is, in fact, a combination of other operations including selection and projection.

See Also: Projection, Selection

Key Expression :

An expression, typically based on one or more database fields, that when evaluated, yields a key value for a database record. Key expressions are most often used to create indexes or for summarization operations.

See Also: Index, Key Value

Key Value :

The value produced by evaluating a key expression. When placed in an index, a key value identifies the logical position of the associated record in its database file.

See Also: Index, Key Expression

Master Index :

The index currently being used to refer to records by key value or sequential record movement commands.

See Also : Controlling/Master Index

Memo Type :

A special database field type consisting of one or more characters in the extended character set. The maximum size of a memo field In Clipper language is 65,534 bytes. A memo field differs only from a character string by the fact it is stored in a separate memo (.DBT file) and the field length is variable-length.

See Also: Character String

Natural Order :

For a database file, the order determined by the sequence in which records were originally entered into the file. Also called unindexed order.

See Also: Index

Normalization :

The process of elimination and consolidation of redundant data elements in a database system.

Projection :

A DBMS term specifying a subset of fields. In Clipper, the analogy is the FIELDS clause.

See Also: Join Selection

Query :

A request for information to be retrieved from a database. Alternately, a data structure in which such a request is encoded.

Record :

The basic row unit of a database file consisting of one or more field elements.

See Also: Database, Field, Table, Tuple

Relation :

A link between database files that allows the record pointer to move in more than one database file based on the value of a common field or expression. This allows information to be accessed from more than one database file at a time.

Relational Database System :

A system that stores data in rows and columns, without system dependencies within the data. In other words, relationships between different databases are not stored in the actual database itself, as is the case in a system that uses record pointers.

Row :

A group of related column or field values that are treated as a single entity. It is the same as a Clipper language record.

See Also: Column, Field, Record

Search Condition :

See : Condition, Scope

Scope :

In a database command, a clause that specifies a range of database records to be addressed by the command. The scope clause uses the qualifiers ALL, NEXT, RECORD, and REST to define the record scope.

See Also: Condition

SDF File :

A text file that contains fixed-length database records with each record separated by a carriage return/linefeed pair (CHR(13) + CHR(10)) and terminated with an end of file mark (CHR(26)). Each field within an SDF file is fixed-length with character strings padded with trailing spaces and numeric values padded with leading spaces. There are no field separators.

See Also: Database, Delimited File, Text File

Selection :

A DBMS term that specifies a subset of records meeting a condition. The selection itself is obtained with a selection operator. In Clipper language, the analogy is the FOR clause.

Separator :

The character or set of characters that differentiate fields or records from one another. In Clipper language, the DELIMITED and SDF file types have separators. The DELIMITED file uses a comma as the field separator and a carriage return/linefeed pair as the record separator. The SDF file type has no field separator, but also uses a carriage return/linefeed pair as the record separator.

See Also: Delimiter

Sort Order :

Describes the various ways database files and arrays are ordered.

. Ascending

Causes the order of data in a sort to be from lowest value to highest value.

. Descending

Causes the order of data in a sort to be from highest value to lowest value.

. Chronological

Causes data in a sort to be ordered based on a date value, from earliest to most recent.


Causes data in a sort to be ordered according to the ASCII Code values of the data to be sorted.

. Dictionary

The data in a sort is ordered in the way it would appear if the items sorted were entries in a dictionary of the English language.

. Collating Sequence

Data in a sort will be placed in sequence following the order of characters in the Extended Character Set.

. Natural

The order in which data was entered into the database.

Table :

A DBMS term defining a collection of column definitions and row values. In Clipper, it is represented and referred to as a database file.

Tuple :

A formal DBMS term that refers to a row in a table or a record in a database file. In DIF files, tuple also refers to the equivalent of a table record.

See Also: Database, Field, Record

Update :

The process of changing the value of fields in one or more records. Database fields are updated by various commands and the assignment operator.

Vector :

In a DIF file, vector refers to the equivalent of a table field.

See Also: Database, Field, Record, Tuple

View :

A DBMS term that defines a virtual table. A virtual table does not actually exist but is derived from existing tables and maintained as a definition. The definition in turn is maintained in a separate file or as an entry in a system dictionary file. In Clipper, views are supported only by DBU.EXE and are maintained in (.vew) files.

See Also: Database, Field, Record

Work Area :

The basic containment area of a database file and its associated indexes. Work areas can be referred to by alias name, number, or a letter designator.

See Also: Alias