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); +