SA-MP Forums Archive
Fatal Error 100 cannot read from file: "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: Fatal Error 100 cannot read from file: "strtok" (/showthread.php?tid=610874)



Fatal Error 100 cannot read from file: "strtok" - Jumberi - 29.06.2016

: fatal error 100: cannot read from file: "strtok"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Fatal Error 100 cannot read from file: "strtok" - Stinged - 29.06.2016

Delete that line (#include <strtok>)
And add this instead:

Код:
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;
}
You should look into using sscanf though, it's a lot faster and easier to use.


Re: Fatal Error 100 cannot read from file: "strtok" - Dayrion - 29.06.2016

DELETED.


Re: Fatal Error 100 cannot read from file: "strtok" - Jumberi - 29.06.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Delete that line (#include <strtok>)
And add this instead:

Код:
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;
}
You should look into using sscanf though, it's a lot faster and easier to use.
thank you