Merge branch 'mueller/cfdp-update-without-handlers' into mueller/new-cfdp-update-with-handlers
This commit is contained in:
commit
47df9e8b5b
@ -83,7 +83,11 @@ class HasFileSystemIF {
|
|||||||
virtual ReturnValue_t truncateFile(FilesystemParams params) = 0;
|
virtual ReturnValue_t truncateFile(FilesystemParams params) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generic function to append to file.
|
* @brief Generic function to write to a file.
|
||||||
|
*
|
||||||
|
* @details
|
||||||
|
* Implementations should not truncate the file. This is equivalent to opening a file with "r+" on Unix systems
|
||||||
|
* or using ios::out | ios::in with the C++ API.
|
||||||
* @param fileOpInfo General information: File name, size to write, offset, additional arguments
|
* @param fileOpInfo General information: File name, size to write, offset, additional arguments
|
||||||
* @param data The data to write to the file
|
* @param data The data to write to the file
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +18,9 @@ ReturnValue_t HostFilesystem::writeToFile(FileOpParams params, const uint8_t *da
|
|||||||
if (not exists(path)) {
|
if (not exists(path)) {
|
||||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
ofstream file(path, ios::binary | ios::out);
|
// This is equivalent to "r+" mode, which is what we need here. Only using ::out would truncate
|
||||||
|
// the file
|
||||||
|
ofstream file(path, ios::binary | ios::out | ios::in);
|
||||||
if (file.fail()) {
|
if (file.fail()) {
|
||||||
return HasFileSystemIF::GENERIC_FILE_ERROR;
|
return HasFileSystemIF::GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user