hb_D - Petewg/harbour-core GitHub Wiki
π 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>
becomesNIL
. (expected result, since any omitted arguments are always passed asNIL
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 defaultVM'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>
. returns0
on success, or anFError
code on failure. -
hb_DirDelete(
<cDir>
) β nSuccess
attempt to delete<cDir>
. returns0
on success, or anFError
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 theF_DATE
element, which here is atimestamp
value (valtype:T
) whereas in Directory() value is adate
(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
returnscDir
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, then1 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 bySET 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 atimestamp
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