1e41f4b71Sopenharmony_ci# Accessing Application Files (C/C++) 
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## When to Use
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe **FileIO** module provides APIs for basic file operations.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci## Basic Concepts
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciURI: uniquely identifies a file.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## Constraints
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci- Before performing file operations, ensure that the URI or path passed in is correct and valid.
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Available APIs
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciFor details about the APIs, see [FileIO](../reference/apis-core-file-kit/_file_i_o.md).
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci| API| Description|
20e41f4b71Sopenharmony_ci| -------- | -------- |
21e41f4b71Sopenharmony_ci| FileManagement_ErrCode OH_FileIO_GetFileLocation(char *uri, int uriLength, FileIO_FileLocation *location)| Obtains the location of a file.|
22e41f4b71Sopenharmony_ci| enum FileIO_FileLocation FileIO_FileLocation| Enumerates the file locations.|
23e41f4b71Sopenharmony_ci| enum enum FileManagement_ErrCode FileManagement_ErrCode| Enumerates the error codes used in the **FileIO** module.|
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci## How to Develop
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**Adding the Dynamic Link Library**
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciAdd the following library to **CMakeLists.txt**.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci```txt
32e41f4b71Sopenharmony_citarget_link_libraries(sample PUBLIC libohfileio.so)
33e41f4b71Sopenharmony_ci```
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**Adding the Header File**
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci```c++
38e41f4b71Sopenharmony_ci#include <filemanagement/fileio/oh_fileio.h>
39e41f4b71Sopenharmony_ci```
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ciUse **OH_FileIO_GetFileLocation** to obtain the location of a file. <br>Example:
42e41f4b71Sopenharmony_ci```c
43e41f4b71Sopenharmony_ci    void GetFileLocationExample() {
44e41f4b71Sopenharmony_ci        char *uri = "file://com.example.demo/data/storage/el2/base/files/test.txt";
45e41f4b71Sopenharmony_ci        FileIO_FileLocation location;
46e41f4b71Sopenharmony_ci        FileManagement_ErrCode ret = OH_FileIO_GetFileLocation(uri, strlen(uri), &location);
47e41f4b71Sopenharmony_ci        if (ret == 0) {
48e41f4b71Sopenharmony_ci            if (location == FileIO_FileLocation::LOCAL) {
49e41f4b71Sopenharmony_ci                printf("This file is on local.");
50e41f4b71Sopenharmony_ci            } else if (location == FileIO_FileLocation::CLOUD) {
51e41f4b71Sopenharmony_ci                printf("This file is on cloud.");
52e41f4b71Sopenharmony_ci            } else if (location == FileIO_FileLocation::LOCAL_AND_CLOUD) {
53e41f4b71Sopenharmony_ci                printf("This file is both on local and cloud.");
54e41f4b71Sopenharmony_ci            }
55e41f4b71Sopenharmony_ci        } else {
56e41f4b71Sopenharmony_ci            printf("GetFileLocation failed, error code is %d", ret);
57e41f4b71Sopenharmony_ci        }
58e41f4b71Sopenharmony_ci    }    
59e41f4b71Sopenharmony_ci   ```
60