Harbour All Functions – D

Date()
Day()
Days()

DaysInMonth()
DaysToMonth()

dbAppend()
dbClearFilter()
dbCloseAll()
dbCloseArea()
dbCommit()
dbCommitAll()
dbCreate()
dbDelete()
dbEval()
dbF()
dbFilter()
dbGoBottom()
dbGoTo()
dbGoTop()
dbReCall()
dbRLock()
dbRLockList()
dbRUnlock()
dbSeek()
dbSelectArea()
dbSetDriver()
dbSetFilter()
dbSkip()
dbSkipper()
dbStruct()
dbUnlock()
dbUnlockAll()
dbUseArea()

DecToBin()
DecToHexa()
DecToOctal()

Deleted()
Descend()
DevOutPict()
DirChange()
DirRemove()
DiskSpace()

DMY()
Do()
DoW()

DOY
DToC()

DToR
DToS()

RecSize()

RECSIZE()

Returns the size of a single record in an active database.

Syntax

      RECSIZE() --> nBytes

Arguments

(This function has no arguments)

Returns

<nBytes> The record size.

Description

This function returns the number os bytes used by a single record in the currently selected or designated database file. If no database is in use in this work area, the return value from this function will be 0.

Examples

      USE tests NEW
      DBGOTOP()
      RECSIZE()            // Returns 1
      DBGOTO( 50 )
      RECSIZE()

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), FIELDNAME(), HEADER(), LASTREC()

Header()

HEADER()

Return the length of a database file header

Syntax

      HEADER() --> nBytes

Returns

<nBytes> The numeric size of a database file header in bytes

Description

This function returns the number of bytes in the header of the selected database ot the database in the designated work area.

If used in conjunction with the LASTREC(), RECSIZE() and DISKSPACE() functions, this functions is capable of implementing a backup and restore routine.

Examples

      USE tests NEW
      ? Header()

Compliance

Clipper

Files

Library is rdd

Seealso

DISKSPACE(), LASTREC(), RECSIZE()

HB_DiskSpace()

HB_DISKSPACE()

Get the amount of space available on a disk

Syntax

      HB_DISKSPACE( [<cDrive>] [, <nType>] ) --> nDiskbytes

Arguments

<cDrive> The drive letter you are requesting info on. The default is A:

<nType> The type of space being requested. The default is HB_DISK_AVAIL.

Returns

<nDiskBytes> The number of bytes on the requested disk that match the requested type.

Description

By default, this function will return the number of bytes of free space on the current drive that is available to the user requesting the information.

There are 4 types of information available:

HB_FS_AVAIL The amount of space available to the user making the request. This value could be less than HB_FS_FREE if disk quotas are supported by the O/S in use at runtime, and disk quotas are in effect. Otherwise, the value will be equal to that returned for HB_FS_FREE.

HB_FS_FREE The actual amount of free diskspace on the drive.

HB_FS_USED The number of bytes in use on the disk.

HB_FS_TOTAL The total amount of space allocated for the user if disk quotas are in effect, otherwise, the actual size of the drive.

If information is requested on a disk that is not available, a runtime error 2018 will be raised.

Examples

      #include "fileio.ch"
      ? "You can use : " + hb_ntos( hb_DiskSpace() ) + " bytes " +;
        "Out of a total of " + hb_ntos( hb_DiskSpace( "C:", HB_FS_TOTAL ) )

      Note: See tests\tstdspac.prg for another example

Compliance

Harbour

Platforms

DOS, Win, OS2, Unix

Files

Library is rtl Header is fileio.ch

DiskSpace()

DISKSPACE()

Get the amount of space available on a disk

Syntax

      DISKSPACE( [<nDrive>] ) --> nDiskbytes

Arguments

<nDrive> The number of the drive you are requesting info on where 1 = A, 2 = B, etc. For 0 or no parameter, DiskSpace will operate on the current drive. The default is 0

Returns

<nDiskBytes> The number of bytes on the requested disk that match the requested type.

Description

By default, this function will return the number of bytes of free space on the current drive that is available to the user requesting the information.

If information is requested on a disk that is not available, a runtime error 2018 will be raised.

Examples

      ? "You can use : " + hb_ntos( DiskSpace() ) + " bytes "

      Note: See tests\tstdspac.prg for another example

Compliance

Clipper

Platforms

DOS, Win, OS2

Files

Library is rtl Header is fileio.ch

C5_DISKSPACE

 DISKSPACE()
 Return the space available on a specified disk
------------------------------------------------------------------------------
 Syntax

     DISKSPACE([<nDrive>]) --> nBytes

 Arguments

     <nDrive> is the number of the drive to query, where one is drive A,
     two is B, three is C, etc.  The default is the current DOS drive if
     <nDrive> is omitted or specified as zero.

 Returns

     DISKSPACE() returns the number of bytes of empty space on the specified
     disk drive as an integer numeric value.

 Description

     DISKSPACE() is an environment function that determines the number of
     available bytes remaining on the specified disk drive.  It is useful
     when COPYing or SORTing to another drive to determine if there is enough
     space available before initiating the operation.  You may also use
     DISKSPACE() with RECSIZE() and RECCOUNT() to create a procedure to back
     up database files.

     DISKSPACE() ignores the SET DEFAULT drive setting.

 Examples

     .  This example is a user-defined function that demonstrates the
        use of DISKSPACE() to back up a database file to another drive:

        FUNCTION BackUp( cTargetFile, cTargetDrive )
           LOCAL nSpaceNeeded, nTargetDrive
           //
           nSpaceNeeded := INT((RECSIZE() * ;
              LASTREC()) + HEADER() + 1)
           nTargetDrive := ASC(UPPER(cTargetDrive)) - 64
           //
           IF DISKSPACE(nTargetDrive) < nSpaceNeeded
              RETURN .F.
           ENDIF
           COPY TO (cTargetDrive + ":" + cTargetFile)
           //
           RETURN .T.

 Files   Library is EXTEND.LIB.


See Also: LASTREC() LUPDATE() RECSIZE()

 

C5 File Management Commands and Functions

High Level :

ADIR()* :

Fill a series of arrays with directory information

ADIR( [ <cFilespec> ],
    [ <aFilenames> ],
    [ <aSizes> ],
    [ <aDates> ],
    [ <aTimes> ],
    [ <aAttributes> ] ) --> nFiles

CLOSE :

Close a specific set of files

CLOSE [ <idAlias> | ALL | ALTERNATE | DATABASES | FORMAT |INDEXES ]

COPY FILE :

Copy a file to a new file

COPY FILE <xcSourceFile> TO <xcTargetFile> | <xcDevice>

CURDIR() :

Return the current DOS directory

CURDIR( [ <cDrivespec> ] ) --> cDirectory

DELETE FILE :

Remove a file from disk

DELETE FILE | ERASE <xcFile>

DIR* :

Display a listing of files from a specified path

DIR [ <xcFileSpec> ]

        DIRCHANGE() :

      Change the current DOS directory

       DIRCHANGE(<cDir>) --> nSuccess

DIRECTORY() :

Create an array of directory and file information

DIRECTORY( <cDirSpec>, [ <cAttributes> ] ) --> aDirectory

 DIRMAKE()

         Create a directory

        DIRMAKE(<cNewDir>) --> nSuccess

          DIRREMOVE() :

     Remove a directory

       DIRREMOVE(<cDirName>) --> nSuccess

          DISKCHANGE() :

       Change the current DOS disk drive

        DISKCHANGE(<cDrive>) --> lSuccess

          DISKNAME() :

                  Return the current DOS drive

        DISKNAME() --> cDrive

DISKSPACE() :

Return the space available on a specified disk

DISKSPACE( [ <nDrive> ] ) --> nBytes

ERASE :

Remove a file from disk

ERASE | DELETE FILE <xcFile>

FILE() :

Determine if files exist in the default directory or path

FILE( <cFilespec> ) --> lExists

RENAME :

Change the name of a file

RENAME <xcOldFile> TO <xcNewFile>

SET ALTERNATE :

Echo console output to a text file

SET ALTERNATE TO [ <xcFile> [ADDITIVE]]
SET ALTERNATE on | OFF | <xlToggle>

SET DEFAULT :

Set the CA-Clipper default drive and directory

SET DEFAULT TO [ <xcPathspec> ]

SET PATH :

Specify the CA-Clipper search path for opening files

SET PATH TO [ <xcPathspec list> ]

TYPE :

Display the contents of a text file

TYPE <xcFile> [TO PRINTER] [TO FILE <xcOutFile> ]

Low-level :

FCLOSE() :

Close an open binary file and write DOS buffers to disk

FCLOSE( <nHandle> ) --> lError

FCREATE() :

Create and/or truncate a binary file to zero length

FCREATE( <cFile>, [ <nAttribute> ] ) --> nHandle

FERASE() :

Delete a file from disk

FERASE( <cFile> ) --> nSuccess

FERROR() :

Test for errors after a binary file operation

FERROR() --> nErrorCode

FOPEN() :

Open a binary file

FOPEN( <cFile>, [ <nMode> ] ) --> nHandle

FREAD() :

Read characters from a binary file into a buffer variable

FREAD( <nHandle>, @<cBufferVar>, <nBytes> ) --> nBytes

FREADSTR() :

Read characters from a binary file

FREADSTR( <nHandle>, <nBytes> ) --> cString

          FRENAME() :

Change the name of a file

       FRENAME( <cOldFile>, <cNewFile> ) --> nSuccess

FSEEK() :

Set a binary file pointer to a new position

FSEEK( <nHandle>, <nOffset>, [ <nOrigin> ] ) --> nPosition

FWRITE() :

Write to an open binary file

FWRITE( <nHandle>, <cBuffer>, [ <nBytes> ] )
    --> nBytesWritten

HEADER() :

Return the current database file header length

HEADER() --> nBytes