OLD | NEW |
1 .. _devguide-coding-fileio: | 1 .. _devguide-coding-fileio: |
2 | 2 |
3 ######## | 3 ######## |
4 File I/O | 4 File I/O |
5 ######## | 5 ######## |
6 | 6 |
7 .. contents:: | 7 .. contents:: |
8 :local: | 8 :local: |
9 :backlinks: none | 9 :backlinks: none |
10 :depth: 2 | 10 :depth: 2 |
11 | 11 |
12 Introduction | 12 Introduction |
13 ============ | 13 ============ |
14 | 14 |
15 This chapter describes how to use the `FileIO API | 15 This section describes how to use the `FileIO API |
16 </native-client/pepper_stable/cpp/classpp_1_1_file_i_o>`_ to read and write | 16 </native-client/pepper_stable/cpp/classpp_1_1_file_i_o>`_ to read and write |
17 files using a local secure data store. | 17 files using a local secure data store. |
18 | 18 |
19 You might use the File IO API with the URL Loading APIs to create an overall | 19 You might use the File IO API with the URL Loading APIs to create an overall |
20 data download and caching solution for your NaCl applications. For example: | 20 data download and caching solution for your NaCl applications. For example: |
21 | 21 |
22 #. Use the File IO APIs to check the local disk to see if a file exists that | 22 #. Use the File IO APIs to check the local disk to see if a file exists that |
23 your program needs. | 23 your program needs. |
24 #. If the file exists locally, load it into memory using the File IO API. If | 24 #. If the file exists locally, load it into memory using the File IO API. If |
25 the file doesn't exist locally, use the URL Loading API to retrieve the | 25 the file doesn't exist locally, use the URL Loading API to retrieve the |
26 file from the server. | 26 file from the server. |
27 #. Use the File IO API to write the file to disk. | 27 #. Use the File IO API to write the file to disk. |
28 #. Load the file into memory using the File IO API when needed by your | 28 #. Load the file into memory using the File IO API when needed by your |
29 application. | 29 application. |
30 | 30 |
31 The example discussed in this chapter is included in the SDK in the directory | 31 The example discussed in this section is included in the SDK in the directory |
32 ``examples/api/file_io``. | 32 ``examples/api/file_io``. |
33 | 33 |
34 Reference information | 34 Reference information |
35 ===================== | 35 ===================== |
36 | 36 |
37 For reference information related to FileIO, see the following documentation: | 37 For reference information related to FileIO, see the following documentation: |
38 | 38 |
39 * `file_io.h </native-client/pepper_stable/cpp/file__io_8h>`_ - API to create a | 39 * `file_io.h </native-client/pepper_stable/cpp/file__io_8h>`_ - API to create a |
40 FileIO object | 40 FileIO object |
41 * `file_ref.h </native-client/pepper_stable/cpp/file__ref_8h>`_ - API to create | 41 * `file_ref.h </native-client/pepper_stable/cpp/file__ref_8h>`_ - API to create |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 .. naclcode:: | 545 .. naclcode:: |
546 | 546 |
547 int32_t result = ref.MakeDirectory( | 547 int32_t result = ref.MakeDirectory( |
548 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); | 548 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); |
549 if (result != PP_OK) { | 549 if (result != PP_OK) { |
550 ShowErrorMessage("Make directory failed", result); | 550 ShowErrorMessage("Make directory failed", result); |
551 return; | 551 return; |
552 } | 552 } |
553 ShowStatusMessage("Make directory success"); | 553 ShowStatusMessage("Make directory success"); |
OLD | NEW |