raw_dir.h

Overview

Provides functions related to rawfile directories, including traversing and closing rawfile directories.

File to include: <rawfile/raw_dir.h>

Library: librawfile.z.so

System capability: SystemCapability.Global.ResourceManager

Since: 8

Related module: rawfile

Summary

Structs

Name typedef Keyword Description
RawDir RawDir Provides access to the rawfile directory.

Functions

Name Description
const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index) Obtains the name of a file in rawfile based on the index. You can use this function to traverse the rawfile directory.
int OH_ResourceManager_GetRawFileCount(RawDir *rawDir) Obtains the number of rawfiles in RawDir. You can use this function to obtain available indexes in OH_ResourceManager_GetRawFileName.
void OH_ResourceManager_CloseRawDir(RawDir *rawDir) Closes an opened RawDir and releases all associated resources.

Function Description

OH_ResourceManager_GetRawFileName()

const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index)

Description

Obtains the name of a file in rawfile based on the index. You can use this function to traverse the rawfile directory.

Since: 8

Parameters

Name Description
RawDir *rawDir Pointer to RawDir.
int index Index of the rawfile in RawDir.

Returns

Type Description
const char * File name obtained if the rawfile exists in the directory. The file name returned can be used as the input parameter of OH_ResourceManager_OpenRawFile.
If no file is found after all files in the directory are traversed, NULL is returned.

Reference

OH_ResourceManager_OpenRawFile

OH_ResourceManager_GetRawFileCount()

int OH_ResourceManager_GetRawFileCount(RawDir *rawDir)

Description

Obtains the number of rawfiles in RawDir. You can use this function to obtain available indexes in OH_ResourceManager_GetRawFileName.

Since: 8

Parameters

Name Description
RawDir *rawDir Pointer to RawDir.

Returns

Type Description
int Number of files in rawDir. If rawDir is empty, 0 is returned.

Reference

OH_ResourceManager_GetRawFileName

OH_ResourceManager_CloseRawDir()

void OH_ResourceManager_CloseRawDir(RawDir *rawDir)

Description

Closes an opened RawDir and releases all associated resources.

Since: 8

Parameters

Name Description
RawDir *rawDir Pointer to RawDir.

Reference

OH_ResourceManager_OpenRawDir