Raised This Month: $ Target: $400
 0% 

fgets, format (general messup)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 04-10-2009 , 17:23   Re: fgets, format (general messup)
Reply With Quote #6

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.
__________________

Community / No support through PM
danielkza is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:15.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode