added request amb278
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40827
This commit is contained in:
parent
1049600e99
commit
459a9d41ba
@ -448,6 +448,25 @@ static cell_t sm_WriteFileLine(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t sm_FlushFile(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||||
|
HandleError herr;
|
||||||
|
HandleSecurity sec;
|
||||||
|
FILE *pFile;
|
||||||
|
|
||||||
|
sec.pOwner = NULL;
|
||||||
|
sec.pIdentity = g_pCoreIdent;
|
||||||
|
|
||||||
|
if ((herr=g_HandleSys.ReadHandle(hndl, g_FileType, &sec, (void **)&pFile))
|
||||||
|
!= HandleError_None)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Invalid file handle %x (error %d)", hndl, herr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (fflush(pFile) == 0) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
static cell_t sm_BuildPath(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_BuildPath(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
char path[PLATFORM_MAX_PATH], *fmt, *buffer;
|
char path[PLATFORM_MAX_PATH], *fmt, *buffer;
|
||||||
@ -523,5 +542,6 @@ REGISTER_NATIVES(filesystem)
|
|||||||
{"LogToGame", sm_LogToGame},
|
{"LogToGame", sm_LogToGame},
|
||||||
{"LogMessage", sm_LogMessage},
|
{"LogMessage", sm_LogMessage},
|
||||||
{"LogError", sm_LogError},
|
{"LogError", sm_LogError},
|
||||||
|
{"FlushFile", sm_FlushFile},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -168,6 +168,15 @@ native bool:DirExists(const String:path[]);
|
|||||||
*/
|
*/
|
||||||
native FileSize(const String:path[]);
|
native FileSize(const String:path[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flushes a file's buffered output; any buffered output
|
||||||
|
* is immediately written to the file.
|
||||||
|
*
|
||||||
|
* @param file Handle to the file.
|
||||||
|
* @return True on success, false on failure.
|
||||||
|
*/
|
||||||
|
native FlushFile(Handle:file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a directory.
|
* Removes a directory.
|
||||||
* @note On most Operating Systems you cannot remove a directory which has files inside it.
|
* @note On most Operating Systems you cannot remove a directory which has files inside it.
|
||||||
|
Loading…
Reference in New Issue
Block a user