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 topic" id="contents"> | 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"> |
11 <li><a class="reference internal" href="#enabling-local-file-i-o" id="id5">Enabl
ing local file I/O</a></li> | 11 <li><a class="reference internal" href="#enabling-local-file-i-o" id="id5">Enabl
ing local file I/O</a></li> |
12 <li><a class="reference internal" href="#testing-local-file-i-o" id="id6">Testin
g local file I/O</a></li> | 12 <li><a class="reference internal" href="#testing-local-file-i-o" id="id6">Testin
g local file I/O</a></li> |
13 </ul> | 13 </ul> |
14 </li> | 14 </li> |
15 <li><p class="first"><a class="reference internal" href="#the-file-io-example" i
d="id7">The <code>file_io</code> example</a></p> | 15 <li><p class="first"><a class="reference internal" href="#the-file-io-example" i
d="id7">The <code>file_io</code> example</a></p> |
(...skipping 11 matching lines...) Expand all Loading... |
27 <li><a class="reference internal" href="#opening-a-file-system-and-preparing-for
-file-i-o" id="id15">Opening a file system and preparing for file I/O</a></li> | 27 <li><a class="reference internal" href="#opening-a-file-system-and-preparing-for
-file-i-o" id="id15">Opening a file system and preparing for file I/O</a></li> |
28 <li><a class="reference internal" href="#handling-messages-from-javascript" id="
id16">Handling messages from JavaScript</a></li> | 28 <li><a class="reference internal" href="#handling-messages-from-javascript" id="
id16">Handling messages from JavaScript</a></li> |
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 </div> | 37 |
38 <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="htt
ps://developers.google.com/native-client/peppercpp/classpp_1_1_file_i_o">FileIO
API</a> | 40 <p>This chapter describes how to use the <a class="reference external" href="htt
ps://developers.google.com/native-client/peppercpp/classpp_1_1_file_i_o">FileIO
API</a> |
41 to read and write files using a local secure data store.</p> | 41 to read and write 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 |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); | 489 PP_MAKEDIRECTORYFLAG_NONE, pp::BlockUntilComplete()); |
490 if (result != PP_OK) { | 490 if (result != PP_OK) { |
491 ShowErrorMessage("Make directory failed", result); | 491 ShowErrorMessage("Make directory failed", result); |
492 return; | 492 return; |
493 } | 493 } |
494 ShowStatusMessage("Make directory success"); | 494 ShowStatusMessage("Make directory success"); |
495 </pre> | 495 </pre> |
496 </section></section></section> | 496 </section></section></section> |
497 | 497 |
498 {{/partials.standard_nacl_article}} | 498 {{/partials.standard_nacl_article}} |
OLD | NEW |