| | 659 | /** |
|---|
| | 660 | * Reads the file into memory. |
|---|
| | 661 | * |
|---|
| | 662 | * The caller must free the memory using RTFileReadAllFree(). |
|---|
| | 663 | * |
|---|
| | 664 | * @returns IPRT status code. |
|---|
| | 665 | * @param pszFilename The name of the file. |
|---|
| | 666 | * @param ppvFile Where to store the pointer to the memory on successful return. |
|---|
| | 667 | * @param pcbFile Where to store the size of the file on successful return. |
|---|
| | 668 | * |
|---|
| | 669 | * @remarks Note that this function may be implemented using memory mapping, which means |
|---|
| | 670 | * that the file may remain open until RTFileReadAllFree() is called. It also |
|---|
| | 671 | * means that the return memory may reflect the state of the file when it's |
|---|
| | 672 | * accessed instead of when this call was done. So, in short, don't use this |
|---|
| | 673 | * API for volatile files, then rather use the extended variant with a |
|---|
| | 674 | * yet-to-be-defined. |
|---|
| | 675 | */ |
|---|
| | 676 | RTDECL(int) RTFileReadAll(const char *pszFilename, void **ppvFile, size_t *pcbFile); |
|---|
| | 677 | |
|---|
| | 678 | /** |
|---|
| | 679 | * Reads the file into memory. |
|---|
| | 680 | * |
|---|
| | 681 | * The caller must free the memory using RTFileReadAllFree(). |
|---|
| | 682 | * |
|---|
| | 683 | * @returns IPRT status code. |
|---|
| | 684 | * @param pszFilename The name of the file. |
|---|
| | 685 | * @param off The offset to start reading at. |
|---|
| | 686 | * @param cbMax The maximum number of bytes to read into memory. Specify RTFOFF_MAX |
|---|
| | 687 | * to read to the end of the file. |
|---|
| | 688 | * @param fFlags Flags for the future, must be 0. |
|---|
| | 689 | * @param ppvFile Where to store the pointer to the memory on successful return. |
|---|
| | 690 | * @param pcbFile Where to store the size of the file on successful return. |
|---|
| | 691 | * |
|---|
| | 692 | * @remarks See the remarks for RTFileReadAll. |
|---|
| | 693 | */ |
|---|
| | 694 | RTDECL(int) RTFileReadAllEx(const char *pszFilename, RTFOFF off, RTFOFF cbMax, uint32_t fFlags, void **ppvFile, size_t *pcbFile); |
|---|
| | 695 | |
|---|
| | 696 | /** |
|---|
| | 697 | * Reads the file into memory. |
|---|
| | 698 | * |
|---|
| | 699 | * The caller must free the memory using RTFileReadAllFree(). |
|---|
| | 700 | * |
|---|
| | 701 | * @returns IPRT status code. |
|---|
| | 702 | * @param File The handle to the file. |
|---|
| | 703 | * @param ppvFile Where to store the pointer to the memory on successful return. |
|---|
| | 704 | * @param pcbFile Where to store the size of the file on successful return. |
|---|
| | 705 | * |
|---|
| | 706 | * @remarks See the remarks for RTFileReadAll. |
|---|
| | 707 | */ |
|---|
| | 708 | RTDECL(int) RTFileReadAllByHandle(RTFILE File, void **ppvFile, size_t *pcbFile); |
|---|
| | 709 | |
|---|
| | 710 | /** |
|---|
| | 711 | * Reads the file into memory. |
|---|
| | 712 | * |
|---|
| | 713 | * The caller must free the memory using RTFileReadAllFree(). |
|---|
| | 714 | * |
|---|
| | 715 | * @returns IPRT status code. |
|---|
| | 716 | * @param File The handle to the file. |
|---|
| | 717 | * @param off The offset to start reading at. |
|---|
| | 718 | * @param cbMax The maximum number of bytes to read into memory. Specify RTFOFF_MAX |
|---|
| | 719 | * to read to the end of the file. |
|---|
| | 720 | * @param fFlags Flags for the future, must be 0. |
|---|
| | 721 | * @param ppvFile Where to store the pointer to the memory on successful return. |
|---|
| | 722 | * @param pcbFile Where to store the size of the file on successful return. |
|---|
| | 723 | * |
|---|
| | 724 | * @remarks See the remarks for RTFileReadAll. |
|---|
| | 725 | */ |
|---|
| | 726 | RTDECL(int) RTFileReadAllByHandleEx(RTFILE File, RTFOFF off, RTFOFF cbMax, uint32_t fFlags, void **ppvFile, size_t *pcbFile); |
|---|
| | 727 | |
|---|
| | 728 | /** |
|---|
| | 729 | * Frees the memory returned by one of the RTFileReadAll(), RTFileReadAllEx(), |
|---|
| | 730 | * RTFileReadAllByHandle() and RTFileReadAllByHandleEx() functions. |
|---|
| | 731 | * |
|---|
| | 732 | * @param pvFile Pointer to the memory. |
|---|
| | 733 | * @param cbFile The size of the memory. |
|---|
| | 734 | */ |
|---|
| | 735 | RTDECL(int) RTFileReadAllFree(void **ppvFile, size_t *pcbFile); |
|---|
| | 736 | |
|---|