Skip to content
Pete edited this page Feb 27, 2024 · 49 revisions

🔙 Home

NOTE: All database-handling functions, that is, functions whose names usually are prefixed by db*** , hb_db*** and ord*** , have been grouped in a separate page. Follow this link to move there.

  • hb_Date([<nYear>, <nMonth>, <nDay>]) dDate
    Harbour extension to the Date() function that returns a date value from the supplied day, month and year values. If any of them is invalid or missing, an empty date is returned. If none of them is supplied, the current date is returned.

  • hb_DateTime([<nYear>, <nMonth>, <nDay>, <nHour>, <nMinute>, <nSecond>, <nFragment>]) tTimeStamp
    Returns a timestamp value from the supplied day, month, year, hour, minute, second and second-fragment values. If none of them is supplied, the current date and time is returned.

  • hb_Default(<@xVar>, [<xValue>]) NIL
    Sets the value of variable <xVar> to <xValue> when the current <xVar> value is of different type than <xValue>.

    • <xVar> must be passed by reference.
    • If no <xValue> specified then the <xVar> becomes NIL. (expected result, since any omitted arguments are always passed as NIL to the respective parameters of the invoked function, and as well known, NIL is different of any other value type).
    • If <xVar> has already a value of same type with <xValue> (even empty), it remains untouched!
    • <xVar> must be an existing (already defined) variable, otherwise an RTE (run-time error) occurs.
  • hb_DefaultValue(<xValue>, <xDefaultValue>) xReturn
    returns <xDefaultValue> if <xValue> is NIL or different type of <xDefaultValue>, otherwise returns <xValue>.
    It's similar to hb_Default() but not modifying the variable.

  • hb_Deserialize( <cSerialized>, [<cCdpIN>], [<cCdpOUT>] ) xValue
    reconstructs the <cSerialized> byte sequence, previously created (serialized) by hb_Serialize(), and returns the data in their original structure, (f.e. array, timestamp, object etc).
    The optional parameters <cCdpIN> and <cCdpOUT>, if defined, are used for code-page translation in serialization and de-serialization operations. By default VM's code-page is used.

  • hb_DirBase() cDirName
    returns the application's executable base directory (program statrtup directory).

  • hb_DirBuild(<cDir>) lSuccess
    attempts to create (or to validate the existence of) the given <cDir> directory hierarchy, by recursively adding (if it doesn't already exist) a new path after creating the parent directory. f.e.: hb_DirBuild("sub1/sub2/sub3/") will create successively, "sub1" (if it doesn't exist), afterwards "sub2" under (or inside) "sub1", afterwards "sub3" under "sub2".
    It returns .T. when the directory hierarchy, either exists or was successfully created. Otherwise returns .F.

  • hb_DirCreate(<cDir>) nSuccess
    attempts to create <cDir>. returns 0 on success, or a nFError code on failure.

  • hb_DirDelete(<cDir>) nSuccess
    attempt to delete <cDir>. returns 0 on success, or a nFError code on failure.

  • hb_Directory(<cDirSpec>, [<cAttributes>]) aDirectory
    Returns an array of files matching the <cDirspec> and <cAttributes> (if any) filters. The structure of array is identical to that of Directory() function, except of the F_DATE element, which here is a timestamp value (valtype: T) whereas in Directory() value is a date (valtype: D).
    See also hb_vfDirectory() and hb_DirScan() function, which scans recursively entire working directory tree including subdirectories that may exist inside (or below) it.

  • hb_DirExists(<cDir>) lExists
    checks if <cDir> exists. Note: it won't work with wild-cards.
    returns .T. if <cDir> exists, otherwise .F.

  • hb_DirRemoveAll(<cDir>) lResult
    This function attempts to remove entire <cDir> directory.
    ❗️Warning❗️ Since this function removes recursively whole directories along with their contents, be extremely careful while using it. For example, invoking this function like:

        hb_DirRemoveAll( hb_ps() )

    can remove all files and directories (even those marked as hidden, system or read-only) from current working disk!

  • hb_DirScan(<cPath>, [<cFileMask>], [<cAttr>]) aFiles
    similar to hb_Directory() (refer to it for more..) with the difference that it scans not only <cPath> but also all subdirectories below <cPath> (recursively).

  • hb_DirSepAdd(<cDir>) cDir
    returns <cDir> with a path separator added to the end of it. (if <cDir> already has an ending path separator, nothing added). see also: hb_DirSepDel().

  • hb_DirSepDel(<cDir>) cDir
    returns cDir without path separator at the end of it (if any). The inverse function of 'hb_DirSepAdd()'.

  • hb_DirSepToOS(<cFileName>) cFileName
    replaces the path separators (if any) into <cFileName> with appropriate ones for the O/S used. e.g.: with / for *nix, \ for Win.

  • hb_DirTemp() tempDir
    returns the full name of temp dir including drive letter and a trailing path-separator (similar to 'hb_GetEnv("temp")' which has no trailing path-separator).

  • hb_DirUnbuild(<cDir>) lSuccess
    attempts to remove <cDir> and all subdirectories inside it.
    the operation acts down-to-top, i.e. at first, attempts to delete the lowermost subdirectory. If succeeds, will continue deleting upper directories until either all subdirectories (including topmost) have been deleted, in which case it will return .T., or until a subdirectory cannot be deleted, for some reason (e.g. because it is not empty or is read-only et.c.) and hence it will return .F.
    (might be seen as the inverse of hb_DirBuild())

  • hb_DiskSpace([<cDrive>|<nDrive>] [,<nType>]) nDiskbytes
    returns the free space (in bytes) of <cDrive> (default: current working drive) or the type of space specified by <nType>.
    If <nDrive> is used, then 1 is A: .. 3 is C: and so on.
    Supported types as defined in fileio.ch header file:

    nType Returned value
    HB_DISK_AVAIL (0) The amount of space available to the user making the request. This value could be less than HB_DISK_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_DISK_FREE.
    HB_DISK_FREE (1) The actual amount of free disk space on the drive.
    HB_DISK_USED (2) The number of bytes in use on the disk.
    HB_DISK_TOTAL (3) The total amount of space allocated for the user if disk quotas are in effect, otherwise, the actual size of the drive.

    See also: hb_vfDirSpace() with similar syntax.

  • hb_DispBox(<nTop>,<nLeft>,<nBottom>,<nRight>,[<cBoxChars>],[<cnColor>]) NIL
    displays a box at <nTop>, <nLeft>, <nBottom>, <nRight> drawn using <cBoxChars> or defaults box-chars and optionally colored with <cnColor> which can be either a color template string or numeric color values.

  • hb_DispOutAt(<nRow>, <nCol>, <expression> [, <cColor>]) NIL
    Displays the value of <expression> at specific screen position, without altering current cursor position (and this is the main difference of hb_DispOutAt() from DispOutAt() function).
    Is not affected by SET ALTERNATE setting, which means that output is always directed to screen.

  • hb_DispOutAtBox(<nRow>, <nCol>, <expression> [, <cColor>]) NIL
    Same as hb_DispOutAt(), but draws with the attribute HB_GT_ATTR_BOX, so we can use it to draw graphical elements.

  • hb_DtoC(<dDate>|<tTimeStamp> [, <cDateFormat>]) cDate
    Harbour extension to the DtoC() function. It converts a date value <dDate> (or the date value of <tTimeStamp>) to a string. If no date format is supplied the _SET_DATEFORMAT format will be used.

  • hb_DtoT(<dDate> [, <cnTime>]) tTimeStamp
    returns a timestamp from the date and time values. <dDate> is a date value and <cnTime> is the time part and could be a number (as from Seconds()) or a string (as from Time()), (see time string format).

🔙 Home

Index

Harbour exclusive functions Clipper compatible functions
hb_A A
hb_B B
hb_C C
hb_D D
hb_E E
hb_F F
hb_G G
hb_H H
hb_I I
hb_J_K J K
hb_L L
hb_M M
hb_N_O N O
hb_P P
hb_R Q R
hb_S S
hb_T T
hb_U U
hb_V V W
hb_W X Y

  • Contrib. Libraries
HBWIN WinAPI Library Compress Libraries
HBHPDF Library (Haru) Multi Threading
Harbour Socket API hbCT (Cl*pper tools)
Serial API hbNF (NanForum library)
HBCURL cURL API Library Mini-XML docs

Clone this wiki locally