OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="file-i-o"> | 3 <section id="file-i-o"> |
4 <span id="devguide-coding-fileio"></span><h1 id="file-i-o"><span id="devguide-co
ding-fileio"></span>File I/O</h1> | 4 <span id="devguide-coding-fileio"></span><h1 id="file-i-o"><span id="devguide-co
ding-fileio"></span>File I/O</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><a class="reference internal" href="#introduction" id="id2">Introduction</a>
</li> | 7 <li><a class="reference internal" href="#introduction" id="id2">Introduction</a>
</li> |
8 <li><a class="reference internal" href="#reference-information" id="id3">Referen
ce information</a></li> | 8 <li><a class="reference internal" href="#reference-information" id="id3">Referen
ce information</a></li> |
9 <li><p class="first"><a class="reference internal" href="#local-file-i-o" id="id
4">Local file I/O</a></p> | 9 <li><p class="first"><a class="reference internal" href="#local-file-i-o" id="id
4">Local file I/O</a></p> |
10 <ul class="small-gap"> | 10 <ul class="small-gap"> |
(...skipping 19 matching lines...) Expand all Loading... |
30 <li><a class="reference internal" href="#loading-a-file" id="id18">Loading a fil
e</a></li> | 30 <li><a class="reference internal" href="#loading-a-file" id="id18">Loading a fil
e</a></li> |
31 <li><a class="reference internal" href="#id1" id="id19">Deleting a file</a></li> | 31 <li><a class="reference internal" href="#id1" id="id19">Deleting a file</a></li> |
32 <li><a class="reference internal" href="#listing-files-in-a-directory" id="id20"
>Listing files in a directory</a></li> | 32 <li><a class="reference internal" href="#listing-files-in-a-directory" id="id20"
>Listing files in a directory</a></li> |
33 <li><a class="reference internal" href="#making-a-new-directory" id="id21">Makin
g a new directory</a></li> | 33 <li><a class="reference internal" href="#making-a-new-directory" id="id21">Makin
g a new directory</a></li> |
34 </ul> | 34 </ul> |
35 </li> | 35 </li> |
36 </ul> | 36 </ul> |
37 | 37 |
38 </div><section id="introduction"> | 38 </div><section id="introduction"> |
39 <h2 id="introduction">Introduction</h2> | 39 <h2 id="introduction">Introduction</h2> |
40 <p>This chapter describes how to use the <a class="reference external" href="/na
tive-client/pepper_stable/cpp/classpp_1_1_file_i_o">FileIO API</a> to read and w
rite | 40 <p>This section describes how to use the <a class="reference external" href="/na
tive-client/pepper_stable/cpp/classpp_1_1_file_i_o">FileIO API</a> to read and w
rite |
41 files using a local secure data store.</p> | 41 files using a local secure data store.</p> |
42 <p>You might use the File IO API with the URL Loading APIs to create an overall | 42 <p>You might use the File IO API with the URL Loading APIs to create an overall |
43 data download and caching solution for your NaCl applications. For example:</p> | 43 data download and caching solution for your NaCl applications. For example:</p> |
44 <ol class="arabic simple"> | 44 <ol class="arabic simple"> |
45 <li>Use the File IO APIs to check the local disk to see if a file exists that | 45 <li>Use the File IO APIs to check the local disk to see if a file exists that |
46 your program needs.</li> | 46 your program needs.</li> |
47 <li>If the file exists locally, load it into memory using the File IO API. If | 47 <li>If the file exists locally, load it into memory using the File IO API. If |
48 the file doesn’t exist locally, use the URL Loading API to retrieve the | 48 the file doesn’t exist locally, use the URL Loading API to retrieve the |
49 file from the server.</li> | 49 file from the server.</li> |
50 <li>Use the File IO API to write the file to disk.</li> | 50 <li>Use the File IO API to write the file to disk.</li> |
51 <li>Load the file into memory using the File IO API when needed by your | 51 <li>Load the file into memory using the File IO API when needed by your |
52 application.</li> | 52 application.</li> |
53 </ol> | 53 </ol> |
54 <p>The example discussed in this chapter is included in the SDK in the directory | 54 <p>The example discussed in this section is included in the SDK in the directory |
55 <code>examples/api/file_io</code>.</p> | 55 <code>examples/api/file_io</code>.</p> |
56 </section><section id="reference-information"> | 56 </section><section id="reference-information"> |
57 <h2 id="reference-information">Reference information</h2> | 57 <h2 id="reference-information">Reference information</h2> |
58 <p>For reference information related to FileIO, see the following documentation:
</p> | 58 <p>For reference information related to FileIO, see the following documentation:
</p> |
59 <ul class="small-gap"> | 59 <ul class="small-gap"> |
60 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__i
o_8h">file_io.h</a> - API to create a | 60 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__i
o_8h">file_io.h</a> - API to create a |
61 FileIO object</li> | 61 FileIO object</li> |
62 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__r
ef_8h">file_ref.h</a> - API to create | 62 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__r
ef_8h">file_ref.h</a> - API to create |
63 a file reference or “weak pointer” to a file in a file system</li> | 63 a file reference or “weak pointer” to a file in a file system</li> |
64 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__s
ystem_8h">file_system.h</a> - API to | 64 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__s
ystem_8h">file_system.h</a> - API to |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); | 488 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); |
489 if (result != PP_OK) { | 489 if (result != PP_OK) { |
490 ShowErrorMessage("Make directory failed", result); | 490 ShowErrorMessage("Make directory failed", result); |
491 return; | 491 return; |
492 } | 492 } |
493 ShowStatusMessage("Make directory success"); | 493 ShowStatusMessage("Make directory success"); |
494 </pre> | 494 </pre> |
495 </section></section></section> | 495 </section></section></section> |
496 | 496 |
497 {{/partials.standard_nacl_article}} | 497 {{/partials.standard_nacl_article}} |
OLD | NEW |