stock strtok error - 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: stock strtok error (
/showthread.php?tid=545277)
stock strtok error -
eclipses - 07.11.2014
Hello got a error in this section wish i have no clue to fix, any suggestions or problem sovled sullution?
Error code "Compiling
Код:
C:\Users\Unknown\Desktop\zombie\gamemodes\HellBound.pwn(9915) : error 021: symbol already defined: "strtok"
C:\Users\Unknown\Desktop\zombie\gamemodes\HellBound.pwn(9930) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Code witch the error is set on, red marked area "Problem"
Код:
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: stock strtok error -
LaPiMoNsTeR - 07.11.2014
Try Change name of the function
Re: stock strtok error -
eclipses - 07.11.2014
Quote:
Originally Posted by LaPiMoNsTeR
Try Change name of the function
|
So like this? If im not all out swimming
Marker green
Код:
stock offsert(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: stock strtok error -
eclipses - 07.11.2014
When i changed the name of the function, i got a wierd fuction error.
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Header size: 6164 bytes
Code size: 598592 bytes
Data size: 597580 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 1218720 bytes
Re: stock strtok error -
Kaperstone - 07.11.2014
Quote:
error 021: symbol already defined: "strtok"
|
You already have such a function defined elsewhere.
Anyhow, advicing to use sscanf instead.
Re: stock strtok error -
LaPiMoNsTeR - 07.11.2014
Like you want, just need the name is not strtok, because strtok ils already defined (sry for my bad english, i'm french)