Click or drag to resize

Header Function

X#
Return the length of the database file header.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION Header() AS LONG
Request Example View Source

Return Value

Type: Long
The number of bytes in the header of the database file.
If no database file is in use, Header() returns a 0.
Remarks
Header() is used with LastRec(), RecSize(), and DiskSpace() to create procedures for backing up files.
By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression or by calling the overload that accepts a workarea parameter (a workarea number or alias ).
Examples
This example determines the header size of the SALES.DBF:
X#
1USE sales NEW
2QOut(Header())            // Result: 258
This example defines a pseudofunction, DBFSize(), that uses Header() with RecSize() and LastRec() to calculate the size of the current database file in bytes:
X#
1define DBFSize() ((RecSize() * LastRec()) + Header() + 1)
Later you can use DBFSize() as you would any function:
X#
1USE sales NEW
2USE customer NEW
3QOut(DBFSize())
4QOut(Sales->DBFSize())
See Also