| 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 18 matching lines...) Expand all Loading... |
| 29 <li><a class="reference internal" href="#saving-a-file" id="id17">Saving a file<
/a></li> | 29 <li><a class="reference internal" href="#saving-a-file" id="id17">Saving a file<
/a></li> |
| 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><h2 id="introduction">Introduction</h2> | 38 </div><h2 id="introduction">Introduction</h2> |
| 39 <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 | 39 <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 |
| 40 files using a local secure data store.</p> | 40 files using a local secure data store.</p> |
| 41 <p>You might use the File IO API with the URL Loading APIs to create an overall | 41 <p>You might use the File IO API with the URL Loading APIs to create an overall |
| 42 data download and caching solution for your NaCl applications. For example:</p> | 42 data download and caching solution for your NaCl applications. For example:</p> |
| 43 <ol class="arabic simple"> | 43 <ol class="arabic simple"> |
| 44 <li>Use the File IO APIs to check the local disk to see if a file exists that | 44 <li>Use the File IO APIs to check the local disk to see if a file exists that |
| 45 your program needs.</li> | 45 your program needs.</li> |
| 46 <li>If the file exists locally, load it into memory using the File IO API. If | 46 <li>If the file exists locally, load it into memory using the File IO API. If |
| 47 the file doesn’t exist locally, use the URL Loading API to retrieve the | 47 the file doesn’t exist locally, use the URL Loading API to retrieve the |
| 48 file from the server.</li> | 48 file from the server.</li> |
| 49 <li>Use the File IO API to write the file to disk.</li> | 49 <li>Use the File IO API to write the file to disk.</li> |
| 50 <li>Load the file into memory using the File IO API when needed by your | 50 <li>Load the file into memory using the File IO API when needed by your |
| 51 application.</li> | 51 application.</li> |
| 52 </ol> | 52 </ol> |
| 53 <p>The example discussed in this chapter is included in the SDK in the directory | 53 <p>The example discussed in this section is included in the SDK in the directory |
| 54 <code>examples/api/file_io</code>.</p> | 54 <code>examples/api/file_io</code>.</p> |
| 55 <h2 id="reference-information">Reference information</h2> | 55 <h2 id="reference-information">Reference information</h2> |
| 56 <p>For reference information related to FileIO, see the following documentation:
</p> | 56 <p>For reference information related to FileIO, see the following documentation:
</p> |
| 57 <ul class="small-gap"> | 57 <ul class="small-gap"> |
| 58 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__i
o_8h">file_io.h</a> - API to create a | 58 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__i
o_8h">file_io.h</a> - API to create a |
| 59 FileIO object</li> | 59 FileIO object</li> |
| 60 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__r
ef_8h">file_ref.h</a> - API to create | 60 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__r
ef_8h">file_ref.h</a> - API to create |
| 61 a file reference or “weak pointer” to a file in a file system</li> | 61 a file reference or “weak pointer” to a file in a file system</li> |
| 62 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__s
ystem_8h">file_system.h</a> - API to | 62 <li><a class="reference external" href="/native-client/pepper_stable/cpp/file__s
ystem_8h">file_system.h</a> - API to |
| 63 create a file system associated with a file</li> | 63 create a file system associated with a file</li> |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); | 468 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); |
| 469 if (result != PP_OK) { | 469 if (result != PP_OK) { |
| 470 ShowErrorMessage("Make directory failed", result); | 470 ShowErrorMessage("Make directory failed", result); |
| 471 return; | 471 return; |
| 472 } | 472 } |
| 473 ShowStatusMessage("Make directory success"); | 473 ShowStatusMessage("Make directory success"); |
| 474 </pre> | 474 </pre> |
| 475 </section> | 475 </section> |
| 476 | 476 |
| 477 {{/partials.standard_nacl_article}} | 477 {{/partials.standard_nacl_article}} |
| OLD | NEW |