From 0f8c61c1e1bb970fa12ab786c87fe216c381cecf Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 7 Feb 2009 23:43:07 +0000 Subject: [PATCH] Re-added fflush function (bug 3355, r=sawce). --- amxmodx/file.cpp | 8 ++++++++ plugins/include/file.inc | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/amxmodx/file.cpp b/amxmodx/file.cpp index f474f059..66a2b78b 100755 --- a/amxmodx/file.cpp +++ b/amxmodx/file.cpp @@ -855,6 +855,13 @@ static cell LoadFileForMe(AMX *amx, cell *params) return count; } +static cell AMX_NATIVE_CALL amx_fflush(AMX *amx, cell *params) +{ + FILE *fp = (FILE *)params[1]; + + return fflush(fp); +} + AMX_NATIVE_INFO file_Natives[] = { {"delete_file", delete_file}, @@ -891,5 +898,6 @@ AMX_NATIVE_INFO file_Natives[] = {"fputs", amx_fputs}, {"rename_file", amx_rename}, {"LoadFileForMe", LoadFileForMe}, + {"fflush", amx_fflush}, {NULL, NULL} }; diff --git a/plugins/include/file.inc b/plugins/include/file.inc index c284787f..14d9379f 100755 --- a/plugins/include/file.inc +++ b/plugins/include/file.inc @@ -132,3 +132,12 @@ native close_dir(dirh); * are returned. */ native LoadFileForMe(const file[], buffer[], maxlength, &length=0); + +/** + * Flushes a buffered output stream. + * + * @param file File handle, or 0 for all open streams. + * @return 0 on success, -1 on failure. + */ +native fflush(file); +