#include <c4d_file.h>
Used with Filename::SetMemoryWriteMode() to make a BaseFile write to a memory buffer instead of a file.
- Note
- Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
◆ MemoryFileStruct()
◆ ~MemoryFileStruct()
◆ Alloc()
Allocates a memory file. Destroy the allocated memory file with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
- Returns
- The allocated memory file, or nullptr if the allocation failed.
◆ Free()
Destructs memory files allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.
- Parameters
-
[in,out] | mfs | The memory file to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
◆ GetData() [1/2]
void GetData |
( |
void *& |
data, |
|
|
Int & |
size |
|
) |
| const |
Gets the data written to the memory file.
- Since
- R16
- Parameters
-
[out] | data | Assigned a pointer to the data written. |
[out] | size | Assigned the size of the data written. |
◆ GetData() [2/2]
void GetData |
( |
void *& |
data, |
|
|
Int & |
size, |
|
|
Bool |
release = false |
|
) |
| |
Gets the data written to the memory file.
- Parameters
-
[out] | data | Assigned a pointer to the data written. |
[out] | size | Assigned the size of the data written. |
[in] | release | If true the ownership of the memory block is transfered to the caller, who then needs to free the memory with DeleteMem.
Otherwise the memory block will be freed when the MemoryFileStruct is destructed. |