Help with strtok and tmp etc.
#5

Quote:
Originally Posted by Bakr
View Post
No offense, but that's just idiotic. Why would you WANT to use an outdated and inefficient method when you have faster options available, that are twice as easy to learn?

Anyway, it helps if you actually understood what the strtok function did. It simply removes white spaces found in a string, based on an index to start searching at.
pawn Code:
new
   tmp1[ 128 ],
   tmp2[ 128 ],
   tmp3[ 128 ],
   idx;

tmp1 = strtok( cmdtext, idx ); // Finds the first parameter
tmp2 = strtok( cmdtext, idx ); // Finds the second parameter
tmp3 = strtok( cmdtext, idx ); // Finds the third parameter
Note that this method is not very flexible, and you will have to use the functions in those orders to retrieve the desired data. The variable we created, idx, will store the index of the current white space. That's why when you call the strtok function again, it doesn't return the same white space.
I know it's stupid, but it's just what I wanna do at the moment.

I got 2 errors with that.
Code:
H:\Real RP - V2 Project\gamemodes\rlrp.pwn(28606) : error 006: must be assigned to an array
H:\Real RP - V2 Project\gamemodes\rlrp.pwn(28607) : error 006: must be assigned to an array
pawn Code:
new
            color[22],
            color2[22],
            idx;
        color = strtok( cmdtext, idx ); // Finds the first parameter
        color2 = strtok( cmdtext, idx ); // Finds the second parameter
Reply


Messages In This Thread
Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 05:43
Re: Help with strtok and tmp etc. - by =WoR=Varth - 25.08.2011, 05:54
Re: Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 06:04
Re: Help with strtok and tmp etc. - by Bakr - 25.08.2011, 06:08
Re: Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 06:13
Re: Help with strtok and tmp etc. - by Bakr - 25.08.2011, 06:19
Re: Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 06:25
Re: Help with strtok and tmp etc. - by Bakr - 25.08.2011, 06:27
Re: Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 06:29
Re: Help with strtok and tmp etc. - by Bakr - 25.08.2011, 06:30
Re: Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 06:36
Re: Help with strtok and tmp etc. - by Bakr - 25.08.2011, 06:45
Re: Help with strtok and tmp etc. - by Jack_Leslie - 25.08.2011, 06:50
Re: Help with strtok and tmp etc. - by Speed - 25.08.2011, 07:17

Forum Jump:


Users browsing this thread: 1 Guest(s)