add tk_ostream_file_flush

This commit is contained in:
lixianjing 2020-11-19 18:03:06 +08:00
parent ce016e7c2e
commit f0d8760b75

View File

@ -34,6 +34,12 @@ static ret_t tk_ostream_file_seek(tk_ostream_t* stream, uint32_t offset) {
return fs_file_seek(ostream_file->file, offset);
}
static ret_t tk_ostream_file_flush(tk_ostream_t* stream) {
tk_ostream_file_t* ostream_file = TK_OSTREAM_FILE(stream);
return fs_file_sync(ostream_file->file);
}
static ret_t tk_ostream_file_set_prop(object_t* obj, const char* name, const value_t* v) {
return RET_NOT_FOUND;
}
@ -81,6 +87,7 @@ tk_ostream_t* tk_ostream_file_create_ex(const char* filename, const char* mode)
ostream_file->file = file;
TK_OSTREAM(obj)->write = tk_ostream_file_write;
TK_OSTREAM(obj)->seek = tk_ostream_file_seek;
TK_OSTREAM(obj)->flush = tk_ostream_file_flush;
return TK_OSTREAM(obj);
}