strtok.inc 391 B

123456789101112131415161718
  1. strtok(const string[], &index)
  2. {
  3. new length = strlen(string);
  4. while ((index < length) && (string[index] <= ' '))
  5. {
  6. index++;
  7. }
  8. new offset = index;
  9. new result[20];
  10. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  11. {
  12. result[index - offset] = string[index];
  13. index++;
  14. }
  15. result[index - offset] = EOS;
  16. return result;
  17. }