Jump to main content

##

# 1.2.7.4.26 SYS_FS_DirClose Function

## C

    SYS_FS_RESULT SYS_FS_DirClose
    (
        SYS_FS_HANDLE handle
    );

## Summary

Closes an opened directory.

## Description

This function closes a directory that was opened earlier opened with the SYS_FS_DirOpen function.

## Precondition

A valid directory handle must be obtained before closing the directory.

## Parameters

Param | Description
--- | ---
handle | directory handle obtained during directory open.

## Returns

SYS_FS_RES_SUCCESS - Directory close operation was successful.

SYS_FS_RES_FAILURE - Directory close operation was unsuccessful. The reason for the failure can be retrieved with SYS_FS_Error or SYS_FS_FileError.

## Example

    SYS_FS_HANDLE dirHandle;

    dirHandle = SYS_FS_DirOpen("/mnt/myDrive/Dir1");

    if(dirHandle != SYS_FS_HANDLE_INVALID)
    {
        // Directory open is successful
    }

    // Perform required operation on the directory

    // Close the directory
    if(SYS_FS_DirClose(dirHandle) == SYS_FS_RES_FAILURE)
    {
        // Close operation failed.
    }

## Remarks

None.