From: Brendan Hansen Date: Mon, 19 Apr 2021 20:02:20 +0000 (-0500) Subject: fixed issue when writing to a file more than once X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=91dd9c99bd49e6e874591f51b60282462b78ee8e;p=onyx.git fixed issue when writing to a file more than once --- diff --git a/include/bh.h b/include/bh.h index 69b2becf..4b3586da 100644 --- a/include/bh.h +++ b/include/bh.h @@ -1412,9 +1412,9 @@ b32 bh_file_read_at(bh_file* file, i64 offset, void* buffer, isize buff_size, is b32 bh_file_write_at(bh_file* file, i64 offset, void const* buffer, isize buff_size, isize* bytes_wrote) { isize res; i64 current_offset = 0; + bh__file_seek_wrapper(file->fd, 0, BH_FILE_WHENCE_CURRENT, ¤t_offset); #if defined(_BH_WINDOWS) - bh__file_seek_wrapper(file->fd, 0, BH_FILE_WHENCE_CURRENT, ¤t_offset); res = (isize) WriteFile(file->fd, buffer, buff_size, (i32 *) bytes_wrote, NULL); return res;