浏览代码

document function

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40342 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 15 年之前
父节点
当前提交
69f023d3e7
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      lib/gis/token.c

+ 13 - 1
lib/gis/token.c

@@ -23,7 +23,19 @@
  *
  * Given a string, <b>buf</b>, turn delimiter, <b>delim</b>, into '\0' 
  * (NULL) and place pointers to tokens in tokens.  <b>buf</b> must not 
- * contain a new line (\n).
+ * contain a new line (\n). <b>delim</b> may consist of more than one
+ * character. <i>G_free_tokens()</i> must be called when finished with 
+ * tokens to release memory.
+ *
+ * Example:
+ *   char **tokens;
+ *   int ntok, i;
+ *   tokens = G_tokenize(buf, " |:,");
+ *   ntok = G_number_of_tokens(tokens);
+ *   for (i=0; i < ntok; i++) {
+ *       G_debug(0, "%d=[%s]", i, tokens[i]);
+ *   }
+ *   G_free_tokens(tokens);
  *
  * \param[in] buf input string
  * \param[in] delim string delimiter