![]() |
BSB Developer Docs
|
Library for easy creation and management of temporary files. More...
#include <storage/storage.h>Go to the source code of this file.
Typedefs | |
| typedef struct TempFile | TempFile |
| Opaque TempFile structure declaration. | |
Functions | |
| TempFile * | temp_file_alloc (Storage *storage) |
| Create a TempFile instance. | |
| void | temp_file_free (TempFile *instance) |
| Delete a TempFile instance. | |
| bool | temp_file_create (TempFile *instance, const char *path) |
| Create an underlying file and open it for writing. | |
| bool | temp_file_write (TempFile *instance, const void *data, size_t data_len) |
| Write data to the underlying file. | |
| bool | temp_file_remove (TempFile *instance) |
| Remove the underlying file. | |
Library for easy creation and management of temporary files.
Create a TempFile instance.
This function does not create any files, only allocates a container that can later be used to create a file via temp_file_create().
| [in] | storage | pointer to the Storage instance. |
| bool temp_file_create | ( | TempFile * | instance, |
| const char * | path ) |
Create an underlying file and open it for writing.
This function will create necessary paths if they do not exist.
| [in,out] | instance | pointer to the instance to be used |
| [in] | path | full path to the file to be created |
true if the file could be created, false otherwise | void temp_file_free | ( | TempFile * | instance | ) |
Delete a TempFile instance.
This function does not remove any files it might have created.
| [in,out] | instance | pointer to the instance to be deleted |
| bool temp_file_remove | ( | TempFile * | instance | ) |
Remove the underlying file.
| [in,out] | instance | pointer to the instance to be removed. |
true if the file could be removed, false otherwise | bool temp_file_write | ( | TempFile * | instance, |
| const void * | data, | ||
| size_t | data_len ) |
Write data to the underlying file.
| [in,out] | instance | pointer to the instance to be written to |
| [in] | data | pointer to arbitrary data to be written to the file |
| [in] | data_len | length of the data to be written |
true if the data was written successfully, false otherwise