SA-MP Forums Archive
error 017: undefined symbol "strtok" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 017: undefined symbol "strtok" (/showthread.php?tid=400121)



error 017: undefined symbol "strtok" - kiloman3 - 17.12.2012

admin.pwn(40) : error 017: undefined symbol "strtok"
admin.pwn(40) : error 029: invalid expression, assumed zero
admin.pwn(40) : error 029: invalid expression, assumed zero
admin.pwn(40) : fatal error 107: too many error messages on one line

Whats on line 40-57:
Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}



Re: error 017: undefined symbol "strtok" - maramizo - 17.12.2012

pawn Код:
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: error 017: undefined symbol "strtok" - kiloman3 - 19.12.2012

Fixed, Thanks.