Re-added fflush function (bug 3355, r=sawce).

This commit is contained in:
David Anderson 2009-02-07 23:43:07 +00:00
parent 0b4f28fecf
commit 0f8c61c1e1
2 changed files with 17 additions and 0 deletions

View File

@ -855,6 +855,13 @@ static cell LoadFileForMe(AMX *amx, cell *params)
return count; 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[] = AMX_NATIVE_INFO file_Natives[] =
{ {
{"delete_file", delete_file}, {"delete_file", delete_file},
@ -891,5 +898,6 @@ AMX_NATIVE_INFO file_Natives[] =
{"fputs", amx_fputs}, {"fputs", amx_fputs},
{"rename_file", amx_rename}, {"rename_file", amx_rename},
{"LoadFileForMe", LoadFileForMe}, {"LoadFileForMe", LoadFileForMe},
{"fflush", amx_fflush},
{NULL, NULL} {NULL, NULL}
}; };

View File

@ -132,3 +132,12 @@ native close_dir(dirh);
* are returned. * are returned.
*/ */
native LoadFileForMe(const file[], buffer[], maxlength, &length=0); 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);