DiskFree Function | |
Return the space available on a specified disk.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION DiskFree() AS INT64
public static long DiskFree()
Request Example
View SourceReturn Value
Type:
Int64
The number of bytes of empty space on the specified disk drive.
Remarks
DiskFree() 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.
Examples
This example is a function that demonstrates the use of DiskFree() to back up a database file to another drive:
1FUNCTION BackUp(cTargetFile, cTargetDrive)
2 LOCAL nSpaceNeeded
3 LOCAL lSuccess := FALSE
4
5 nSpaceNeeded := Integer((RecSize() * ;
6 LastRec()) + Header() + 1)
7 IF DiskFree(cTargetDrive) < nSpaceNeeded
8 lSuccess := FALSE
9 ELSE
10
11 DBCloseArea()
12 FCopy("sales.dbf", cTargetDrive + ":"+ cTargetFile)
13 lSuccess := TRUE
14 ENDIF
15 RETURN lSuccess
See Also