StrTok Function
#10

It was made for extracting words from a string (words are separated by white space).
And for command with parameters you need a function which extracts words from a string.
So you can even use split instead of strtok for commands.

http://www.compuphase.com/pawn/pawn-lang.pdf

Page 35

Код:
Listing: strtok.inc
/* extract words from a string (words are separated by white space) */
#include <string>
strtok(const string[], &index)
{
new length = strlen(string)
/* skip leading white space */
while (index < length && string[index] <= ’ ’)
index++
/* store the word letter for letter */
new offset = index /* save start position of token */
new result[20] /* string to store the word in */
while (index < length
&& string[index] > ’ ’
&& index - offset < sizeof result - 1)
{
result[index - offset] = string[index]
index++
}
result[index - offset] = EOS /* zero-terminate the string */
return result
}
As you can see it is even in the pawn doku, strtok has been created before sa-mp even existed. So strtok isnt even made for sa-mp.
Reply


Messages In This Thread
StrTok Function - by [CK]Steel - 22.03.2009, 00:37
Re: StrTok Function - by [CK]Steel - 22.03.2009, 00:42
Re: StrTok Function - by Think - 22.03.2009, 00:48
Re: StrTok Function - by StrickenKid - 22.03.2009, 00:49
Re: StrTok Function - by Pyrokid - 22.03.2009, 01:06
Re: StrTok Function - by Pghpunkid - 22.03.2009, 01:19
Re: StrTok Function - by NigNog1 - 22.03.2009, 01:26
Re: StrTok Function - by Donny_k - 22.03.2009, 01:32
Re: StrTok Function - by Pyrokid - 22.03.2009, 01:37
Re: StrTok Function - by Remis93 - 22.03.2009, 12:04
Re: StrTok Function - by Pghpunkid - 22.03.2009, 20:49
Re: StrTok Function - by BeckzyBoi - 22.03.2009, 21:04
Re: StrTok Function - by Pyrokid - 22.03.2009, 23:59
Re: StrTok Function - by Pghpunkid - 23.03.2009, 00:25
Re: StrTok Function - by Pyrokid - 23.03.2009, 00:35
Re: StrTok Function - by Norn - 23.03.2009, 01:10
Re: StrTok Function - by Mikep - 23.03.2009, 01:13
Re: StrTok Function - by StrickenKid - 23.03.2009, 01:22
Re: StrTok Function - by Pyrokid - 23.03.2009, 01:59
Re: StrTok Function - by Pghpunkid - 23.03.2009, 05:33
Re: StrTok Function - by Donny_k - 23.03.2009, 08:54

Forum Jump:


Users browsing this thread: 18 Guest(s)