 |
|
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
|

04-10-2009
, 17:26
Re: fgets, format (general messup)
|
#7
|
Quote:
Originally Posted by danielkza
Code:
static cell AMX_NATIVE_CALL amx_fgets(AMX *amx, cell *params)
{
FILE *fp = (FILE *)params[1];
if (!fp)
return 0;
static char buffer[4096];
buffer[0] = '\0';
fgets(buffer, sizeof(buffer)-1, fp);
return set_amxstring(amx, params[2], buffer, params[3]);
}
The code seems right, returns 0 on invalid file handle, and set_amxstring() returns the lenght of the string, so it should be 0 when nothing was read.
|
But it reads \r\n according to the include. So, it will only be zero on eof. Correct me if I'm wrong.
__________________
|
|
|
|