|
From: Matthews <dem...@uw...> - 2003-03-05 13:00:08
|
A small question: I'm in the process of creating a scripting language for a game creation system that I use. The method I use is to 1) Grab a line (seperated by semi-colons like C) from the file 2) Get the length of the command (with a small for() loop that increments a length variable until a space is reached) 3) Compare the string to each valid command 4) If a match is found, perform a parameter count (a variation of the previous loop) and make sure there are the correct number 5) Write command bytecode with parameters to compiled script file. This almost works perfectly, there's a strange bug related to a two-part command that sometimes makes the compiler believe there's one more parameter than there actually is. That's not my question though. My question is how could strtok() help me in this situation I've described? I'm not sure how it works, and I'm wondering if it could make my job easier by breaking the line down into different parts for easy counting/comparing. Thanks in advance. |