mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 04:41:36 +03:00
40 lines
816 B
C
40 lines
816 B
C
|
#pragma once
|
||
|
#include <stdlib.h>
|
||
|
#include <storage/storage.h>
|
||
|
#include "stream.h"
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
/**
|
||
|
* Allocate file stream
|
||
|
* @return Stream*
|
||
|
*/
|
||
|
Stream* file_stream_alloc(Storage* storage);
|
||
|
|
||
|
/**
|
||
|
* Opens an existing file or create a new one.
|
||
|
* @param stream pointer to file stream object.
|
||
|
* @param path path to file
|
||
|
* @param access_mode access mode from FS_AccessMode
|
||
|
* @param open_mode open mode from FS_OpenMode
|
||
|
* @return success flag. You need to close the file even if the open operation failed.
|
||
|
*/
|
||
|
bool file_stream_open(
|
||
|
Stream* stream,
|
||
|
const char* path,
|
||
|
FS_AccessMode access_mode,
|
||
|
FS_OpenMode open_mode);
|
||
|
|
||
|
/**
|
||
|
* Closes the file.
|
||
|
* @param stream
|
||
|
* @return true
|
||
|
* @return false
|
||
|
*/
|
||
|
bool file_stream_close(Stream* stream);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|