Help with strtok and tmp etc.
#4

Quote:
Originally Posted by Jack_Leslie
View Post
Hi guys, so I'm having trouble with strtok (I'm using strcmp, not DCMD or anything, and that's what I wanna use so please don't try and convince me otherwise).
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.
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)