Advertisement
Guest User

strtok

a guest
Jul 26th, 2010
2,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.38 KB | None | 0 0
  1. strtok(const string[], &index)
  2. {
  3.     new length = strlen(string);
  4.     while ((index < length) && (string[index] <= ' '))
  5.     {
  6.         index++;
  7.     }
  8.  
  9.     new offset = index;
  10.     new result[20];
  11.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  12.     {
  13.         result[index - offset] = string[index];
  14.         index++;
  15.     }
  16.     result[index - offset] = EOS;
  17.     return result;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement