harmony 鸿蒙FileIO

2025-06-12 浏览 (1)

FileIO

Overview

Provides capabilities of basic file operations.

Since: 12

Summary

Files

NameDescription
error_code.hDefines the error codes for the FileIO module.
oh_fileio.hDefines the native APIs for basic file operations.

Types

NameDescription
typedef enum FileManagement_ErrCode FileManagement_ErrCodeDefines an enum for the error codes used in the FileIO module.
typedef enum FileIO_FileLocation FileIO_FileLocationDefines an enum for file locations.

Enums

NameDescription
FileManagement_ErrCode {
ERR_OK = 0,
ERR_PERMISSION_ERROR = 201,
ERR_INVALID_PARAMETER = 401,
ERR_DEVICE_NOT_SUPPORTED = 801,
ERR_EPERM = 13900001,
ERR_ENOENT = 13900002,
ERR_ENOMEM = 13900011,
ERR_UNKNOWN = 13900042
}
Enumerates the error codes used in the FileIO module.
FileIO_FileLocation {
LOCAL = 1,
CLOUD = 2,
LOCAL_AND_CLOUD = 3
}
Enumerates the file locations.

Functions

NameDescription
FileManagement_ErrCode OH_FileIO_GetFileLocation (char *uri, int uriLength, FileIO_FileLocation *location)Obtains the location of a file.

Type Description

FileIO_FileLocation

typedef enum FileIO_FileLocation FileIO_FileLocation

Description

Defines an enum for file locations.

Since: 12

FileManagement_ErrCode

typedef enum FileManagement_ErrCode FileManagement_ErrCode

Description

Defines an enum for the error codes used in the FileIO module.

Since: 12

Enum Description

FileIO_FileLocation

enum FileIO_FileLocation

Description

Enumerates the file locations.

Since: 12

ValueDescription
LOCALThe file is stored in a local device.
CLOUDThe file is stored in the cloud.
LOCAL_AND_CLOUDThe file is stored in a local device and in the cloud.

FileManagement_ErrCode

enum FileManagement_ErrCode

Description

Enumerates the error codes used in the FileIO module.

Since: 12

ValueDescription
ERR_OKThe API is called successfully.
ERR_PERMISSION_ERRORThe permission verification of the caller fails.
ERR_INVALID_PARAMETERInvalid parameter.
ERR_DEVICE_NOT_SUPPORTEDThe device does not support this interface.
ERR_EPERMThe operation is not allowed.
ERR_ENOENTThe file or folder does not exist.
ERR_ENOMEMA memory overflow occurs.
ERR_UNKNOWNInternal unknown error.

Function Description

OH_FileIO_GetFileLocation()

FileManagement_ErrCode OH_FileIO_GetFileLocation (char * uri, int uriLength, FileIO_FileLocation * location )

Description

Obtains the location of a file.

Since: 12

Parameters

NameDescription
uriPointer to the URI of the file.
uriLengthLength of the URI.
locationPointer to the location of the file obtained.

Returns

Returns FileManagement_ErrCode.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Core File Kit

harmony 鸿蒙Environment

harmony 鸿蒙FileShare_PolicyErrorResult

harmony 鸿蒙FileShare_PolicyInfo

harmony 鸿蒙error_code.h

harmony 鸿蒙File Management Error Codes

harmony 鸿蒙FileShare

harmony 鸿蒙FileUri

harmony 鸿蒙@ohos.application.BackupExtensionAbility (Backup and Restore Extension Capability) (System API)

harmony 鸿蒙@ohos.application.BackupExtensionAbility (BackupExtensionAbility)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/QqO24f