stock strtok error
#1

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;
Reply
#2

Try Change name of the function
Reply
#3

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;
}
Reply
#4

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
Reply
#5

Quote:

error 021: symbol already defined: "strtok"

You already have such a function defined elsewhere.

Anyhow, advicing to use sscanf instead.
Reply
#6

Like you want, just need the name is not strtok, because strtok ils already defined (sry for my bad english, i'm french)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)