# GETDRIVESIZEQQ

Portability Function: Returns the total size of the specified drive and space available on it.

## Module

USE IFPORT

result = GETDRIVESIZEQQ (drive,total,avail)

drive | (Input) Character*(*). String containing the letter of the drive to get information about.
total | (Output) INTEGER(4) or INTEGER(4), DIMENSION(2) or INTEGER(8). Total number of bytes on the drive.
avail | (Output) INTEGER(4) or INTEGER(4), DIMENSION(2) or INTEGER(8). Number of bytes of available space on the drive.

## Results

The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..

The data types and dimension (if any) specified for the total and avail arguments must be the same. Specifying an array of two INTEGER(4) elements, or an INTEGER(8) argument, allows drive sizes larger than 2147483647 to be returned.

If an array of two INTEGER(4) elements is specified, the least-significant 32 bits are returned in the first element, the most-significant 32 bits in the second element. If an INTEGER(4) scalar is specified, the least-significant 32 bits are returned.

Because drives are identified by a single alphabetic character, GETDRIVESIZEQQ examines only the first letter of drive. The drive letter can be uppercase or lowercase. You can use the constant FILE$CURDRIVE (defined in `IFPORT.F90`) to get the size of the current drive.

If GETDRIVESIZEQQ fails, use GETLASTERRORQQ to determine the reason.

## Example

    ! Program to demonstrate GETDRIVESQQ and GETDRIVESIZEQQ
    USE IFPORT
    CHARACTER(26) drives
    CHARACTER(1) adrive
    LOGICAL(4) status
    INTEGER(4) total, avail
    INTEGER(2) i
    ! Get the list of drives
    drives = GETDRIVESQQ()
    WRITE (*,'(A, A)') ' Drives available: ', drives
    !
    !Cycle through them for free space and write to console
    DO i = 1, 26
      adrive = drives(i:i)
      status = .FALSE.
      WRITE (*,'(A, A, A, \)') ' Drive ', CHAR(i + 64), ':'
      IF (adrive .NE. ' ') THEN
         status = GETDRIVESIZEQQ(adrive, total, avail)
      END IF
      IF (status) THEN
         WRITE (*,*) avail, ' of ', total, ' bytes free.'
      ELSE
         WRITE (*,*) 'Not available'
      END IF
    END DO
    END

Parent topic: G

## See Also

GETLASTERRORQQ
GETDRIVESQQ
GETDRIVEDIRQQ
CHANGEDRIVEQQ
CHANGEDIRQQ