mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-12 14:58:06 +03:00
added getc,ungetc,putc
This commit is contained in:
parent
89c58265aa
commit
94c449936d
@ -741,6 +741,39 @@ static cell AMX_NATIVE_CALL amx_get_dir(AMX *amx, cell *params)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//native fgetc( file );
|
||||||
|
static cell AMX_NATIVE_CALL amx_fgetc(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
FILE *fp = (FILE *)params[1];
|
||||||
|
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return fgetc(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
//native fputc( file, data );
|
||||||
|
static cell AMX_NATIVE_CALL amx_fputc(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
FILE *fp = (FILE *)params[1];
|
||||||
|
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return fputc(static_cast<int>(params[2]), fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
//native ungetc( file, data );
|
||||||
|
static cell AMX_NATIVE_CALL amx_ungetc(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
FILE *fp = (FILE *)params[1];
|
||||||
|
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return ungetc(static_cast<int>(params[2]), fp);
|
||||||
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO file_Natives[] =
|
AMX_NATIVE_INFO file_Natives[] =
|
||||||
{
|
{
|
||||||
{"delete_file", delete_file},
|
{"delete_file", delete_file},
|
||||||
@ -770,5 +803,8 @@ AMX_NATIVE_INFO file_Natives[] =
|
|||||||
{"open_dir", amx_open_dir},
|
{"open_dir", amx_open_dir},
|
||||||
{"close_dir", amx_close_dir},
|
{"close_dir", amx_close_dir},
|
||||||
{"next_file", amx_get_dir},
|
{"next_file", amx_get_dir},
|
||||||
|
{"fgetc", amx_fgetc},
|
||||||
|
{"fputc", amx_fputc},
|
||||||
|
{"fungetc", amx_ungetc},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user