1# FileIO 2 3 4## Overview 5 6Provides capabilities of basic file operations. 7 8**Since**: 12 9 10 11## Summary 12 13 14### Files 15 16| Name| Description| 17| -------- | -------- | 18| [error_code.h](error__code_8h.md) | Defines the error codes for the **FileIO** module.| 19| [oh_fileio.h](oh__fileio_8h.md) | Defines the native APIs for basic file operations.| 20 21 22### Types 23 24| Name| Description| 25| -------- | -------- | 26| typedef enum [FileManagement_ErrCode](#filemanagement_errcode-1) [FileManagement_ErrCode](#filemanagement_errcode) | Defines an enum for the error codes used in the **FileIO** module.| 27| typedef enum [FileIO_FileLocation](#fileio_filelocation-1) [FileIO_FileLocation](#fileio_filelocation) | Defines an enum for file locations.| 28 29 30### Enums 31 32| Name| Description| 33| -------- | -------- | 34| [FileManagement_ErrCode](#filemanagement_errcode-1) {<br>ERR_OK = 0,<br>ERR_PERMISSION_ERROR = 201,<br>ERR_INVALID_PARAMETER = 401,<br>ERR_DEVICE_NOT_SUPPORTED = 801,<br>ERR_EPERM = 13900001,<br>ERR_ENOENT = 13900002,<br>ERR_ENOMEM = 13900011,<br>ERR_UNKNOWN = 13900042<br>} | Enumerates the error codes used in the **FileIO** module.| 35| [FileIO_FileLocation](#fileio_filelocation-1) {<br>LOCAL = 1,<br>CLOUD = 2,<br>LOCAL_AND_CLOUD = 3<br>} | Enumerates the file locations.| 36 37 38### Functions 39 40| Name| Description| 41| -------- | -------- | 42| [FileManagement_ErrCode](#filemanagement_errcode) [OH_FileIO_GetFileLocation](#oh_fileio_getfilelocation) (char \*uri, int uriLength, [FileIO_FileLocation](#fileio_filelocation) \*location) | Obtains the location of a file.| 43 44 45## Type Description 46 47 48### FileIO_FileLocation 49 50``` 51typedef enum FileIO_FileLocation FileIO_FileLocation 52``` 53 54**Description** 55 56Defines an enum for file locations. 57 58**Since**: 12 59 60 61### FileManagement_ErrCode 62 63``` 64typedef enum FileManagement_ErrCode FileManagement_ErrCode 65``` 66 67**Description** 68 69Defines an enum for the error codes used in the **FileIO** module. 70 71**Since**: 12 72 73 74## Enum Description 75 76 77### FileIO_FileLocation 78 79``` 80enum FileIO_FileLocation 81``` 82 83**Description** 84 85Enumerates the file locations. 86 87**Since**: 12 88 89| Value| Description| 90| -------- | -------- | 91| LOCAL | The file is stored in a local device.| 92| CLOUD | The file is stored in the cloud.| 93| LOCAL_AND_CLOUD | The file is stored in a local device and in the cloud.| 94 95 96### FileManagement_ErrCode 97 98``` 99enum FileManagement_ErrCode 100``` 101 102**Description** 103 104Enumerates the error codes used in the **FileIO** module. 105 106**Since**: 12 107 108| Value| Description| 109| -------- | -------- | 110| ERR_OK | The API is called successfully.| 111| ERR_PERMISSION_ERROR | The permission verification of the caller fails.| 112| ERR_INVALID_PARAMETER | Invalid parameter.| 113| ERR_DEVICE_NOT_SUPPORTED | The device does not support this interface.| 114| ERR_EPERM | The operation is not allowed.| 115| ERR_ENOENT | The file or folder does not exist.| 116| ERR_ENOMEM | A memory overflow occurs.| 117| ERR_UNKNOWN | Internal unknown error.| 118 119 120## Function Description 121 122 123### OH_FileIO_GetFileLocation() 124 125``` 126FileManagement_ErrCode OH_FileIO_GetFileLocation (char * uri, int uriLength, FileIO_FileLocation * location ) 127``` 128 129**Description** 130 131Obtains the location of a file. 132 133**Since**: 12 134 135**Parameters** 136 137| Name| Description| 138| -------- | -------- | 139| uri | Pointer to the URI of the file.| 140| uriLength | Length of the URI.| 141| location | Pointer to the location of the file obtained.| 142 143**Returns** 144 145Returns [FileManagement_ErrCode](#filemanagement_errcode). 146