1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxFile Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="classwx_file-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">wxFile Class Reference<div class="ingroups"><a class="el" href="group__group__class__file.html">File Handling</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <wx/file.h></code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> performs raw file I/O. </p>
<p>This is a very small class designed to minimize the overhead of using it - in fact, there is hardly any overhead at all, but using it brings you automatic error checking and hides differences between platforms and compilers. <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> also automatically closes the file in its destructor so you won't forget to do so. <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> is a wrapper around <code>file</code> descriptor. - see also <a class="el" href="classwx_f_file.html" title="wxFFile implements buffered file I/O.">wxFFile</a> for a wrapper around <code>FILE</code> structure.</p>
<p><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5" title="The type used to store and provide byte offsets or byte sizes for files or streams.">wxFileOffset</a> is used by the <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> functions which require offsets as parameter or return them. If the platform supports it, wxFileOffset is a typedef for a native 64 bit integer, otherwise a 32 bit integer is used for <a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5" title="The type used to store and provide byte offsets or byte sizes for files or streams.">wxFileOffset</a>.</p>
<h2></h2>
<div><span class="lib">Library:</span>  <span class="lib_text"><a class="el" href="page_libs.html#page_libs_wxbase">wxBase</a></span></div><div><span class="category">Category:</span>  <span class="category_text"><a class="el" href="group__group__class__file.html">File Handling</a></span></div> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ae26cef66ac8e94be0c687c2a0fd569df"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">OpenMode</a> { <br/>
  <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b">read</a>,
<br/>
  <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfabfa8d43f2e87d73f80ae1a181b1544b8">write</a>,
<br/>
  <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfaa08562dcbd6cd8900950880061096e78">read_write</a>,
<br/>
  <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfa938253b5bcf20e1fc14586cc4f132ae7">write_append</a>,
<br/>
  <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfaca62414e4aa186958cae52879475fe3f">write_excl</a>
<br/>
}</td></tr>
<tr class="memdesc:ae26cef66ac8e94be0c687c2a0fd569df"><td class="mdescLeft"> </td><td class="mdescRight">The OpenMode enumeration defines the different modes for opening a file with <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a>. <a href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">More...</a><br/></td></tr>
<tr class="separator:ae26cef66ac8e94be0c687c2a0fd569df"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a322676f2f343841ac17a3ac0fc43cc20"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom">{ <br/>
  <a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20a359b3619a978343a5d73f56d85ce325d">fd_invalid</a> = -1,
<br/>
  <a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20a2d93554cc38b0192eb4ee2470c0a3da3">fd_stdin</a>,
<br/>
  <a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20a38e8e5eadaa724762a1fc8e2268c3298">fd_stdout</a>,
<br/>
  <a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20aeb6c143720130cb92ec6fc29abe23382">fd_stderr</a>
<br/>
}</td></tr>
<tr class="memdesc:a322676f2f343841ac17a3ac0fc43cc20"><td class="mdescLeft"> </td><td class="mdescRight">Standard file descriptors. <a href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20">More...</a><br/></td></tr>
<tr class="separator:a322676f2f343841ac17a3ac0fc43cc20"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad56ba11167f09c6ce6689c6047c15d20"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ad56ba11167f09c6ce6689c6047c15d20">wxFile</a> ()</td></tr>
<tr class="memdesc:ad56ba11167f09c6ce6689c6047c15d20"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#ad56ba11167f09c6ce6689c6047c15d20"></a><br/></td></tr>
<tr class="separator:ad56ba11167f09c6ce6689c6047c15d20"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac41559b817a0cc02fb3f7524431e4221"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ac41559b817a0cc02fb3f7524431e4221">wxFile</a> (const <a class="el" href="classwx_string.html">wxString</a> &filename, <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a> mode=<a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b">wxFile::read</a>)</td></tr>
<tr class="memdesc:ac41559b817a0cc02fb3f7524431e4221"><td class="mdescLeft"> </td><td class="mdescRight">Opens a file with a filename. <a href="#ac41559b817a0cc02fb3f7524431e4221"></a><br/></td></tr>
<tr class="separator:ac41559b817a0cc02fb3f7524431e4221"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aaefb4f5175e5721396cabfb569348c89"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#aaefb4f5175e5721396cabfb569348c89">wxFile</a> (int <a class="el" href="classwx_file.html#a785378439ec028b40e6b5708e4b61c10">fd</a>)</td></tr>
<tr class="memdesc:aaefb4f5175e5721396cabfb569348c89"><td class="mdescLeft"> </td><td class="mdescRight">Associates the file with the given file descriptor, which has already been opened. <a href="#aaefb4f5175e5721396cabfb569348c89"></a><br/></td></tr>
<tr class="separator:aaefb4f5175e5721396cabfb569348c89"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a44707e27c5af7e178ea2139fb21fd3d3"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a44707e27c5af7e178ea2139fb21fd3d3">~wxFile</a> ()</td></tr>
<tr class="memdesc:a44707e27c5af7e178ea2139fb21fd3d3"><td class="mdescLeft"> </td><td class="mdescRight">Destructor will close the file. <a href="#a44707e27c5af7e178ea2139fb21fd3d3"></a><br/></td></tr>
<tr class="separator:a44707e27c5af7e178ea2139fb21fd3d3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9cf7fc7bb53404e017a243fa6151c64f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a9cf7fc7bb53404e017a243fa6151c64f">GetLastError</a> () const </td></tr>
<tr class="memdesc:a9cf7fc7bb53404e017a243fa6151c64f"><td class="mdescLeft"> </td><td class="mdescRight">Returns the error code for the last unsuccessful operation. <a href="#a9cf7fc7bb53404e017a243fa6151c64f"></a><br/></td></tr>
<tr class="separator:a9cf7fc7bb53404e017a243fa6151c64f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8bf168da91695be4da8207a9c3358cbc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a8bf168da91695be4da8207a9c3358cbc">ClearLastError</a> ()</td></tr>
<tr class="memdesc:a8bf168da91695be4da8207a9c3358cbc"><td class="mdescLeft"> </td><td class="mdescRight">Resets the error code. <a href="#a8bf168da91695be4da8207a9c3358cbc"></a><br/></td></tr>
<tr class="separator:a8bf168da91695be4da8207a9c3358cbc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad1721a816177180fd8b464cef6cc54a1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ad1721a816177180fd8b464cef6cc54a1">Attach</a> (int <a class="el" href="classwx_file.html#a785378439ec028b40e6b5708e4b61c10">fd</a>)</td></tr>
<tr class="memdesc:ad1721a816177180fd8b464cef6cc54a1"><td class="mdescLeft"> </td><td class="mdescRight">Attaches an existing file descriptor to the <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> object. <a href="#ad1721a816177180fd8b464cef6cc54a1"></a><br/></td></tr>
<tr class="separator:ad1721a816177180fd8b464cef6cc54a1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac703999133859f1fa67075b89c3c69de"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ac703999133859f1fa67075b89c3c69de">Close</a> ()</td></tr>
<tr class="memdesc:ac703999133859f1fa67075b89c3c69de"><td class="mdescLeft"> </td><td class="mdescRight">Closes the file. <a href="#ac703999133859f1fa67075b89c3c69de"></a><br/></td></tr>
<tr class="separator:ac703999133859f1fa67075b89c3c69de"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4b86bd2e79c8ce3dbdc713949c6b39ca"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a4b86bd2e79c8ce3dbdc713949c6b39ca">Create</a> (const <a class="el" href="classwx_string.html">wxString</a> &filename, bool overwrite=false, int access=<a class="el" href="group__group__funcmacro__file.html#gga64460401fb35c137c9df28f3c019694dad36cd32167ca85203a51fba1ec2f31f2">wxS_DEFAULT</a>)</td></tr>
<tr class="memdesc:a4b86bd2e79c8ce3dbdc713949c6b39ca"><td class="mdescLeft"> </td><td class="mdescRight">Creates a file for writing. <a href="#a4b86bd2e79c8ce3dbdc713949c6b39ca"></a><br/></td></tr>
<tr class="separator:a4b86bd2e79c8ce3dbdc713949c6b39ca"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab7856410c0304ad24a285a2de76f604b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ab7856410c0304ad24a285a2de76f604b">Detach</a> ()</td></tr>
<tr class="memdesc:ab7856410c0304ad24a285a2de76f604b"><td class="mdescLeft"> </td><td class="mdescRight">Get back a file descriptor from <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> object - the caller is responsible for closing the file if this descriptor is opened. <a href="#ab7856410c0304ad24a285a2de76f604b"></a><br/></td></tr>
<tr class="separator:ab7856410c0304ad24a285a2de76f604b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae584442c77415e9d287ca7faec0dcca4"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ae584442c77415e9d287ca7faec0dcca4">Eof</a> () const </td></tr>
<tr class="memdesc:ae584442c77415e9d287ca7faec0dcca4"><td class="mdescLeft"> </td><td class="mdescRight">Returns <span class="literal">true</span> if the end of the file has been reached. <a href="#ae584442c77415e9d287ca7faec0dcca4"></a><br/></td></tr>
<tr class="separator:ae584442c77415e9d287ca7faec0dcca4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0b3ac667c1e6133c6c4ffce3c81b3c4c"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a0b3ac667c1e6133c6c4ffce3c81b3c4c">Flush</a> ()</td></tr>
<tr class="memdesc:a0b3ac667c1e6133c6c4ffce3c81b3c4c"><td class="mdescLeft"> </td><td class="mdescRight">Flushes the file descriptor. <a href="#a0b3ac667c1e6133c6c4ffce3c81b3c4c"></a><br/></td></tr>
<tr class="separator:a0b3ac667c1e6133c6c4ffce3c81b3c4c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a765609522af7fbf010a76902961673be"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__file.html#ga68af15575db590aaa874d40a1073809d">wxFileKind</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a765609522af7fbf010a76902961673be">GetKind</a> () const </td></tr>
<tr class="memdesc:a765609522af7fbf010a76902961673be"><td class="mdescLeft"> </td><td class="mdescRight">Returns the type of the file. <a href="#a765609522af7fbf010a76902961673be"></a><br/></td></tr>
<tr class="separator:a765609522af7fbf010a76902961673be"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a91ba1ec486bbc7668f95cb11e13511fb"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a91ba1ec486bbc7668f95cb11e13511fb">IsOpened</a> () const </td></tr>
<tr class="memdesc:a91ba1ec486bbc7668f95cb11e13511fb"><td class="mdescLeft"> </td><td class="mdescRight">Returns <span class="literal">true</span> if the file has been opened. <a href="#a91ba1ec486bbc7668f95cb11e13511fb"></a><br/></td></tr>
<tr class="separator:a91ba1ec486bbc7668f95cb11e13511fb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a68b1ea981eec7888507fbb5d75fb1749"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a68b1ea981eec7888507fbb5d75fb1749">Length</a> () const </td></tr>
<tr class="memdesc:a68b1ea981eec7888507fbb5d75fb1749"><td class="mdescLeft"> </td><td class="mdescRight">Returns the length of the file. <a href="#a68b1ea981eec7888507fbb5d75fb1749"></a><br/></td></tr>
<tr class="separator:a68b1ea981eec7888507fbb5d75fb1749"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a70f2abe0e310dcf77ea6aeaac60df25b"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a70f2abe0e310dcf77ea6aeaac60df25b">Open</a> (const <a class="el" href="classwx_string.html">wxString</a> &filename, <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a> mode=<a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b">wxFile::read</a>, int access=<a class="el" href="group__group__funcmacro__file.html#gga64460401fb35c137c9df28f3c019694dad36cd32167ca85203a51fba1ec2f31f2">wxS_DEFAULT</a>)</td></tr>
<tr class="memdesc:a70f2abe0e310dcf77ea6aeaac60df25b"><td class="mdescLeft"> </td><td class="mdescRight">Opens the file, returning <span class="literal">true</span> if successful. <a href="#a70f2abe0e310dcf77ea6aeaac60df25b"></a><br/></td></tr>
<tr class="separator:a70f2abe0e310dcf77ea6aeaac60df25b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a411aefd67cf2e33812a06380f973b850"><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a411aefd67cf2e33812a06380f973b850">Read</a> (void *buffer, size_t count)</td></tr>
<tr class="memdesc:a411aefd67cf2e33812a06380f973b850"><td class="mdescLeft"> </td><td class="mdescRight">Reads from the file into a memory buffer. <a href="#a411aefd67cf2e33812a06380f973b850"></a><br/></td></tr>
<tr class="separator:a411aefd67cf2e33812a06380f973b850"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2b1e384806c34a55d90b94b8c2138a23"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a2b1e384806c34a55d90b94b8c2138a23">ReadAll</a> (<a class="el" href="classwx_string.html">wxString</a> *str, const <a class="el" href="classwx_m_b_conv.html">wxMBConv</a> &conv=<a class="el" href="classwx_conv_auto.html">wxConvAuto</a>())</td></tr>
<tr class="memdesc:a2b1e384806c34a55d90b94b8c2138a23"><td class="mdescLeft"> </td><td class="mdescRight">Reads the entire contents of the file into a string. <a href="#a2b1e384806c34a55d90b94b8c2138a23"></a><br/></td></tr>
<tr class="separator:a2b1e384806c34a55d90b94b8c2138a23"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a106441378d84369853a60b0c8846aa9a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a106441378d84369853a60b0c8846aa9a">Seek</a> (<a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> ofs, <a class="el" href="group__group__funcmacro__file.html#gae3981f8632f0391e5c852bf62eb982b0">wxSeekMode</a> mode=<a class="el" href="group__group__funcmacro__file.html#ggae3981f8632f0391e5c852bf62eb982b0afe95aa5f8bbda276d20a0860a2af841d">wxFromStart</a>)</td></tr>
<tr class="memdesc:a106441378d84369853a60b0c8846aa9a"><td class="mdescLeft"> </td><td class="mdescRight">Seeks to the specified position. <a href="#a106441378d84369853a60b0c8846aa9a"></a><br/></td></tr>
<tr class="separator:a106441378d84369853a60b0c8846aa9a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6be7359a2b54f730f4e33c83f9d44d9f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a6be7359a2b54f730f4e33c83f9d44d9f">SeekEnd</a> (<a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> ofs=0)</td></tr>
<tr class="memdesc:a6be7359a2b54f730f4e33c83f9d44d9f"><td class="mdescLeft"> </td><td class="mdescRight">Moves the file pointer to the specified number of bytes relative to the end of the file. <a href="#a6be7359a2b54f730f4e33c83f9d44d9f"></a><br/></td></tr>
<tr class="separator:a6be7359a2b54f730f4e33c83f9d44d9f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afc7eaf653255bf2db25f20626d3eedb1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#afc7eaf653255bf2db25f20626d3eedb1">Tell</a> () const </td></tr>
<tr class="memdesc:afc7eaf653255bf2db25f20626d3eedb1"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current position or <a class="el" href="group__group__funcmacro__file.html#gab184c7199d93541d22ae42e515cbbcb7" title="A special return value of many wxWidgets classes to indicate that an invalid offset was given...">wxInvalidOffset</a> if file is not opened or if another error occurred. <a href="#afc7eaf653255bf2db25f20626d3eedb1"></a><br/></td></tr>
<tr class="separator:afc7eaf653255bf2db25f20626d3eedb1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0974a92a5c8793629fd9ee0f1735657c"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a0974a92a5c8793629fd9ee0f1735657c">Write</a> (const void *buffer, size_t count)</td></tr>
<tr class="memdesc:a0974a92a5c8793629fd9ee0f1735657c"><td class="mdescLeft"> </td><td class="mdescRight">Write data to the file (descriptor). <a href="#a0974a92a5c8793629fd9ee0f1735657c"></a><br/></td></tr>
<tr class="separator:a0974a92a5c8793629fd9ee0f1735657c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aac7158f2a854d1bac2a454e2851849b1"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#aac7158f2a854d1bac2a454e2851849b1">Write</a> (const <a class="el" href="classwx_string.html">wxString</a> &s, const <a class="el" href="classwx_m_b_conv.html">wxMBConv</a> &conv=wxConvUTF8)</td></tr>
<tr class="memdesc:aac7158f2a854d1bac2a454e2851849b1"><td class="mdescLeft"> </td><td class="mdescRight">Writes the contents of the string to the file, returns <span class="literal">true</span> on success. <a href="#aac7158f2a854d1bac2a454e2851849b1"></a><br/></td></tr>
<tr class="separator:aac7158f2a854d1bac2a454e2851849b1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a785378439ec028b40e6b5708e4b61c10"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a785378439ec028b40e6b5708e4b61c10">fd</a> () const </td></tr>
<tr class="memdesc:a785378439ec028b40e6b5708e4b61c10"><td class="mdescLeft"> </td><td class="mdescRight">Returns the file descriptor associated with the file. <a href="#a785378439ec028b40e6b5708e4b61c10"></a><br/></td></tr>
<tr class="separator:a785378439ec028b40e6b5708e4b61c10"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a9842fdcc9d4f4b8c74cf73c2dd48be26"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#a9842fdcc9d4f4b8c74cf73c2dd48be26">Access</a> (const <a class="el" href="classwx_string.html">wxString</a> &name, <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a> mode)</td></tr>
<tr class="memdesc:a9842fdcc9d4f4b8c74cf73c2dd48be26"><td class="mdescLeft"> </td><td class="mdescRight">This function verifies if we may access the given file in specified mode. <a href="#a9842fdcc9d4f4b8c74cf73c2dd48be26"></a><br/></td></tr>
<tr class="separator:a9842fdcc9d4f4b8c74cf73c2dd48be26"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad6530a4db084b157d81a1314c4a62420"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_file.html#ad6530a4db084b157d81a1314c4a62420">Exists</a> (const <a class="el" href="classwx_string.html">wxString</a> &filename)</td></tr>
<tr class="memdesc:ad6530a4db084b157d81a1314c4a62420"><td class="mdescLeft"> </td><td class="mdescRight">Returns <span class="literal">true</span> if the given name specifies an existing regular file (not a directory or a link). <a href="#ad6530a4db084b157d81a1314c4a62420"></a><br/></td></tr>
<tr class="separator:ad6530a4db084b157d81a1314c4a62420"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="a322676f2f343841ac17a3ac0fc43cc20"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">anonymous enum</td>
</tr>
</table>
</div><div class="memdoc">
<p>Standard file descriptors. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a322676f2f343841ac17a3ac0fc43cc20a359b3619a978343a5d73f56d85ce325d"></a>fd_invalid</em> </td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a322676f2f343841ac17a3ac0fc43cc20a2d93554cc38b0192eb4ee2470c0a3da3"></a>fd_stdin</em> </td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a322676f2f343841ac17a3ac0fc43cc20a38e8e5eadaa724762a1fc8e2268c3298"></a>fd_stdout</em> </td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a322676f2f343841ac17a3ac0fc43cc20aeb6c143720130cb92ec6fc29abe23382"></a>fd_stderr</em> </td><td>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ae26cef66ac8e94be0c687c2a0fd569df"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>The OpenMode enumeration defines the different modes for opening a file with <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a>. </p>
<p>It is also used with <a class="el" href="classwx_file.html#a9842fdcc9d4f4b8c74cf73c2dd48be26" title="This function verifies if we may access the given file in specified mode.">wxFile::Access</a> function. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b"></a>read</em> </td><td>
<p>Open file for reading or test if it can be opened for reading with <a class="el" href="classwx_file.html#a9842fdcc9d4f4b8c74cf73c2dd48be26" title="This function verifies if we may access the given file in specified mode.">Access()</a> </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ae26cef66ac8e94be0c687c2a0fd569dfabfa8d43f2e87d73f80ae1a181b1544b8"></a>write</em> </td><td>
<p>Open file for writing deleting the contents of the file if it already exists or test if it can be opened for writing with <a class="el" href="classwx_file.html#a9842fdcc9d4f4b8c74cf73c2dd48be26" title="This function verifies if we may access the given file in specified mode.">Access()</a>. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ae26cef66ac8e94be0c687c2a0fd569dfaa08562dcbd6cd8900950880061096e78"></a>read_write</em> </td><td>
<p>Open file for reading and writing; cannot be used with <a class="el" href="classwx_file.html#a9842fdcc9d4f4b8c74cf73c2dd48be26" title="This function verifies if we may access the given file in specified mode.">Access()</a> </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ae26cef66ac8e94be0c687c2a0fd569dfa938253b5bcf20e1fc14586cc4f132ae7"></a>write_append</em> </td><td>
<p>Open file for appending: the file is opened for writing, but the old contents of the file are not erased and the file pointer is initially placed at the end of the file; cannot be used with <a class="el" href="classwx_file.html#a9842fdcc9d4f4b8c74cf73c2dd48be26" title="This function verifies if we may access the given file in specified mode.">Access()</a>. </p>
<p>This is the same as OpenMode::write if the file doesn't exist. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ae26cef66ac8e94be0c687c2a0fd569dfaca62414e4aa186958cae52879475fe3f"></a>write_excl</em> </td><td>
<p>Open the file securely for writing (Uses O_EXCL | O_CREAT). </p>
<p>Will fail if the file already exists, else create and open it atomically. Useful for opening temporary files without being vulnerable to race exploits. </p>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="ad56ba11167f09c6ce6689c6047c15d20"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxFile::wxFile </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<a class="anchor" id="ac41559b817a0cc02fb3f7524431e4221"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxFile::wxFile </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>filename</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a> </td>
<td class="paramname"><em>mode</em> = <code><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b">wxFile::read</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Opens a file with a filename. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">filename</td><td>The filename. </td></tr>
<tr><td class="paramname">mode</td><td>The mode in which to open the file.</td></tr>
</table>
</dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>You should use <a class="el" href="classwx_file.html#a91ba1ec486bbc7668f95cb11e13511fb" title="Returns true if the file has been opened.">IsOpened()</a> to verify that the constructor succeeded. </dd></dl>
</div>
</div>
<a class="anchor" id="aaefb4f5175e5721396cabfb569348c89"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxFile::wxFile </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>fd</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Associates the file with the given file descriptor, which has already been opened. </p>
<p>See <a class="el" href="classwx_file.html#ad1721a816177180fd8b464cef6cc54a1" title="Attaches an existing file descriptor to the wxFile object.">Attach()</a> for the list of predefined descriptors.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">fd</td><td>An existing file descriptor. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a44707e27c5af7e178ea2139fb21fd3d3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxFile::~wxFile </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor will close the file. </p>
<dl class="section note"><dt>Note</dt><dd>This destructor is not virtual so you should not use <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> polymorphically. </dd></dl>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a9842fdcc9d4f4b8c74cf73c2dd48be26"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static bool wxFile::Access </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a> </td>
<td class="paramname"><em>mode</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>This function verifies if we may access the given file in specified mode. </p>
<p>Only values of <code><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b" title="Open file for reading or test if it can be opened for reading with Access()">wxFile::read</a></code> or <code><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfabfa8d43f2e87d73f80ae1a181b1544b8" title="Open file for writing deleting the contents of the file if it already exists or test if it can be ope...">wxFile::write</a></code> really make sense here. </p>
</div>
</div>
<a class="anchor" id="ad1721a816177180fd8b464cef6cc54a1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxFile::Attach </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>fd</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Attaches an existing file descriptor to the <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> object. </p>
<p>Examples of predefined file descriptors are 0, 1 and 2 which correspond to stdin, stdout and stderr (and have symbolic names of <code><a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20a2d93554cc38b0192eb4ee2470c0a3da3">wxFile::fd_stdin</a></code>, <code><a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20a38e8e5eadaa724762a1fc8e2268c3298">wxFile::fd_stdout</a></code> and <code><a class="el" href="classwx_file.html#a322676f2f343841ac17a3ac0fc43cc20aeb6c143720130cb92ec6fc29abe23382">wxFile::fd_stderr</a></code>).</p>
<p>The descriptor should be already opened and it will be closed by <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> object. </p>
</div>
</div>
<a class="anchor" id="a8bf168da91695be4da8207a9c3358cbc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxFile::ClearLastError </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Resets the error code. </p>
<p><a class="el" href="classwx_file.html#a9cf7fc7bb53404e017a243fa6151c64f" title="Returns the error code for the last unsuccessful operation.">GetLastError()</a> will return 0 until the next error occurs.</p>
<dl class="section since"><dt>Since</dt><dd>2.9.2 </dd></dl>
</div>
</div>
<a class="anchor" id="ac703999133859f1fa67075b89c3c69de"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::Close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Closes the file. </p>
</div>
</div>
<a class="anchor" id="a4b86bd2e79c8ce3dbdc713949c6b39ca"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::Create </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>filename</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>overwrite</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>access</em> = <code><a class="el" href="group__group__funcmacro__file.html#gga64460401fb35c137c9df28f3c019694dad36cd32167ca85203a51fba1ec2f31f2">wxS_DEFAULT</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a file for writing. </p>
<p>If the file already exists, setting <b>overwrite</b> to <span class="literal">true</span> will ensure it is overwritten.</p>
<p><em>access</em> may be an OR combination of the <a class="el" href="group__group__funcmacro__file.html#ga64460401fb35c137c9df28f3c019694d" title="File permission bit names.">wxPosixPermissions</a> enumeration values. </p>
</div>
</div>
<a class="anchor" id="ab7856410c0304ad24a285a2de76f604b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxFile::Detach </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get back a file descriptor from <a class="el" href="classwx_file.html" title="A wxFile performs raw file I/O.">wxFile</a> object - the caller is responsible for closing the file if this descriptor is opened. </p>
<p><a class="el" href="classwx_file.html#a91ba1ec486bbc7668f95cb11e13511fb" title="Returns true if the file has been opened.">IsOpened()</a> will return <span class="literal">false</span> after call to <a class="el" href="classwx_file.html#ab7856410c0304ad24a285a2de76f604b" title="Get back a file descriptor from wxFile object - the caller is responsible for closing the file if thi...">Detach()</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>The file descriptor (this is new since wxWidgets 3.0.0, in the previous versions this method didn't return anything). </dd></dl>
</div>
</div>
<a class="anchor" id="ae584442c77415e9d287ca7faec0dcca4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::Eof </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns <span class="literal">true</span> if the end of the file has been reached. </p>
<p>Note that the behaviour of the file pointer-based class <a class="el" href="classwx_f_file.html" title="wxFFile implements buffered file I/O.">wxFFile</a> is different as <a class="el" href="classwx_f_file.html#a16992b8b1da3d2a06b8be60529f29327" title="Returns true if an attempt has been made to read past the end of the file.">wxFFile::Eof()</a> will return <span class="literal">true</span> here only if an attempt has been made to read <b>past</b> the last byte of the file, while <a class="el" href="classwx_file.html#ae584442c77415e9d287ca7faec0dcca4" title="Returns true if the end of the file has been reached.">wxFile::Eof()</a> will return <span class="literal">true</span> even before such attempt is made if the file pointer is at the last position in the file.</p>
<p>Note also that this function doesn't work on unseekable file descriptors (examples include pipes, terminals and sockets under Unix) and an attempt to use it will result in an error message.</p>
<p>So, to read the entire file into memory, you should write a loop which uses <a class="el" href="classwx_file.html#a411aefd67cf2e33812a06380f973b850" title="Reads from the file into a memory buffer.">Read()</a> repeatedly and tests its return condition instead of using <a class="el" href="classwx_file.html#ae584442c77415e9d287ca7faec0dcca4" title="Returns true if the end of the file has been reached.">Eof()</a> as this will not work for special files under Unix. </p>
</div>
</div>
<a class="anchor" id="ad6530a4db084b157d81a1314c4a62420"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static bool wxFile::Exists </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>filename</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns <span class="literal">true</span> if the given name specifies an existing regular file (not a directory or a link). </p>
</div>
</div>
<a class="anchor" id="a785378439ec028b40e6b5708e4b61c10"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxFile::fd </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the file descriptor associated with the file. </p>
</div>
</div>
<a class="anchor" id="a0b3ac667c1e6133c6c4ffce3c81b3c4c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::Flush </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Flushes the file descriptor. </p>
<p>Note that <a class="el" href="classwx_file.html#a0b3ac667c1e6133c6c4ffce3c81b3c4c" title="Flushes the file descriptor.">Flush()</a> is not implemented on some Windows compilers due to a missing fsync function, which reduces the usefulness of this function (it can still be called but it will do nothing on unsupported compilers). </p>
</div>
</div>
<a class="anchor" id="a765609522af7fbf010a76902961673be"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__file.html#ga68af15575db590aaa874d40a1073809d">wxFileKind</a> wxFile::GetKind </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the type of the file. </p>
</div>
</div>
<a class="anchor" id="a9cf7fc7bb53404e017a243fa6151c64f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int wxFile::GetLastError </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the error code for the last unsuccessful operation. </p>
<p>The error code is system-dependent and corresponds to the value of the standard <code>errno</code> variable when the last error occurred.</p>
<p>Notice that only simple accessors such as <a class="el" href="classwx_file.html#a91ba1ec486bbc7668f95cb11e13511fb" title="Returns true if the file has been opened.">IsOpened()</a> and <a class="el" href="classwx_file.html#ae584442c77415e9d287ca7faec0dcca4" title="Returns true if the end of the file has been reached.">Eof()</a> (and this method itself) don't modify the last error value, all other methods can potentially change it if an error occurs, including the const ones such as <a class="el" href="classwx_file.html#afc7eaf653255bf2db25f20626d3eedb1" title="Returns the current position or wxInvalidOffset if file is not opened or if another error occurred...">Tell()</a> or <a class="el" href="classwx_file.html#a68b1ea981eec7888507fbb5d75fb1749" title="Returns the length of the file.">Length()</a>.</p>
<dl class="section since"><dt>Since</dt><dd>2.9.2</dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classwx_file.html#a8bf168da91695be4da8207a9c3358cbc" title="Resets the error code.">ClearLastError()</a> </dd></dl>
</div>
</div>
<a class="anchor" id="a91ba1ec486bbc7668f95cb11e13511fb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::IsOpened </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns <span class="literal">true</span> if the file has been opened. </p>
</div>
</div>
<a class="anchor" id="a68b1ea981eec7888507fbb5d75fb1749"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> wxFile::Length </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the length of the file. </p>
</div>
</div>
<a class="anchor" id="a70f2abe0e310dcf77ea6aeaac60df25b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::Open </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>filename</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569df">wxFile::OpenMode</a> </td>
<td class="paramname"><em>mode</em> = <code><a class="el" href="classwx_file.html#ae26cef66ac8e94be0c687c2a0fd569dfae10ad0bce1ba499f9d8164e1d6ca037b">wxFile::read</a></code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>access</em> = <code><a class="el" href="group__group__funcmacro__file.html#gga64460401fb35c137c9df28f3c019694dad36cd32167ca85203a51fba1ec2f31f2">wxS_DEFAULT</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Opens the file, returning <span class="literal">true</span> if successful. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">filename</td><td>The filename. </td></tr>
<tr><td class="paramname">mode</td><td>The mode in which to open the file. </td></tr>
<tr><td class="paramname">access</td><td>An OR-combination of <a class="el" href="group__group__funcmacro__file.html#ga64460401fb35c137c9df28f3c019694d" title="File permission bit names.">wxPosixPermissions</a> enumeration values. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a411aefd67cf2e33812a06380f973b850"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ssize_t wxFile::Read </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>count</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads from the file into a memory buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>Buffer to write in </td></tr>
<tr><td class="paramname">count</td><td>Bytes to read</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes read, or the symbol <a class="el" href="group__group__funcmacro__file.html#gab184c7199d93541d22ae42e515cbbcb7" title="A special return value of many wxWidgets classes to indicate that an invalid offset was given...">wxInvalidOffset</a>. </dd></dl>
</div>
</div>
<a class="anchor" id="a2b1e384806c34a55d90b94b8c2138a23"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::ReadAll </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classwx_string.html">wxString</a> * </td>
<td class="paramname"><em>str</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classwx_m_b_conv.html">wxMBConv</a> & </td>
<td class="paramname"><em>conv</em> = <code><a class="el" href="classwx_conv_auto.html">wxConvAuto</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads the entire contents of the file into a string. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>Non-<span class="literal">NULL</span> pointer to a string to read data into. </td></tr>
<tr><td class="paramname">conv</td><td>Conversion object to use in Unicode build; by default supposes that file contents is encoded in UTF-8 but falls back to the current locale encoding (or Latin-1 if it is UTF-8 too) if it is not.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><span class="literal">true</span> if file was read successfully, <span class="literal">false</span> otherwise.</dd></dl>
<dl class="section since"><dt>Since</dt><dd>2.9.5 </dd></dl>
</div>
</div>
<a class="anchor" id="a106441378d84369853a60b0c8846aa9a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> wxFile::Seek </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> </td>
<td class="paramname"><em>ofs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__group__funcmacro__file.html#gae3981f8632f0391e5c852bf62eb982b0">wxSeekMode</a> </td>
<td class="paramname"><em>mode</em> = <code><a class="el" href="group__group__funcmacro__file.html#ggae3981f8632f0391e5c852bf62eb982b0afe95aa5f8bbda276d20a0860a2af841d">wxFromStart</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Seeks to the specified position. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ofs</td><td>Offset to seek to. </td></tr>
<tr><td class="paramname">mode</td><td>One of wxFromStart, wxFromEnd, wxFromCurrent.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The actual offset position achieved, or <a class="el" href="group__group__funcmacro__file.html#gab184c7199d93541d22ae42e515cbbcb7" title="A special return value of many wxWidgets classes to indicate that an invalid offset was given...">wxInvalidOffset</a> on failure. </dd></dl>
</div>
</div>
<a class="anchor" id="a6be7359a2b54f730f4e33c83f9d44d9f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> wxFile::SeekEnd </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> </td>
<td class="paramname"><em>ofs</em> = <code>0</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Moves the file pointer to the specified number of bytes relative to the end of the file. </p>
<p>For example, <code>SeekEnd</code>(-5) would position the pointer 5 bytes before the end.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ofs</td><td>Number of bytes before the end of the file.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The actual offset position achieved, or <a class="el" href="group__group__funcmacro__file.html#gab184c7199d93541d22ae42e515cbbcb7" title="A special return value of many wxWidgets classes to indicate that an invalid offset was given...">wxInvalidOffset</a> on failure. </dd></dl>
</div>
</div>
<a class="anchor" id="afc7eaf653255bf2db25f20626d3eedb1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__file.html#ga69d831b3febabc149c67b716c8e22de5">wxFileOffset</a> wxFile::Tell </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the current position or <a class="el" href="group__group__funcmacro__file.html#gab184c7199d93541d22ae42e515cbbcb7" title="A special return value of many wxWidgets classes to indicate that an invalid offset was given...">wxInvalidOffset</a> if file is not opened or if another error occurred. </p>
</div>
</div>
<a class="anchor" id="a0974a92a5c8793629fd9ee0f1735657c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t wxFile::Write </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>count</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Write data to the file (descriptor). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>Buffer from which to read data </td></tr>
<tr><td class="paramname">count</td><td>Number of bytes to write</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes written. </dd></dl>
</div>
</div>
<a class="anchor" id="aac7158f2a854d1bac2a454e2851849b1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxFile::Write </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_string.html">wxString</a> & </td>
<td class="paramname"><em>s</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classwx_m_b_conv.html">wxMBConv</a> & </td>
<td class="paramname"><em>conv</em> = <code>wxConvUTF8</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Writes the contents of the string to the file, returns <span class="literal">true</span> on success. </p>
<p>The second argument is only meaningful in Unicode build of wxWidgets when <em>conv</em> is used to convert <em>s</em> to a multibyte representation.</p>
<p>Note that this method only works with <code>NUL-terminated</code> strings, if you want to write data with embedded <code>NULs</code> to the file you should use the other <a class="el" href="classwx_file.html#a0974a92a5c8793629fd9ee0f1735657c" title="Write data to the file (descriptor).">Write()</a> overload. </p>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:47 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|