[Overview][Constants][Types][Procedures and functions][Variables][Index] | Reference for unit 'Dos' (#rtl)

# DiskSize

Get total size of disk.

## Declaration

Source position: dosh.inc line 108

`function DiskSize(`
`drive: Byte`
`):Int64;`

## Description

DiskSize returns the total size (in bytes) of a disk. The parameter Drive indicates which disk should be checked. This parameter is 1 for floppy a:, 2 for floppy b:, etc. A value of 0 returns the size of the current drive.

Remark: | For unix only: The diskfree and disksize functions need a file on the specified drive, since this is required for the statfs system call. These filenames are set in the initialization of the dos unit, and have been preset to :

- '.' for the current drive,
- '/fd0/.' for the first floppy-drive (linux only).
- '/fd1/.' for the second floppy-drive (linux only).
- '/' for the first hard disk.

There is room for 1-26 drives. You can add a drive with the AddDisk procedure. These settings can be coded in dos.pp, in the initialization part.

For an example, see DiskFree.

## Errors

-1 when a failure occurs, or an invalid drive number is given.

## See also

DiskFree |  | Get free size on Disk.
AddDisk |  | Add disk definition to list if drives (Unix only)

Documentation generated on: Feb 26 2014