[GRASS-SVN] r40342 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 9 04:14:22 EST 2010


Author: hamish
Date: 2010-01-09 04:14:21 -0500 (Sat, 09 Jan 2010)
New Revision: 40342

Modified:
   grass/trunk/lib/gis/token.c
Log:
document function

Modified: grass/trunk/lib/gis/token.c
===================================================================
--- grass/trunk/lib/gis/token.c	2010-01-09 08:51:24 UTC (rev 40341)
+++ grass/trunk/lib/gis/token.c	2010-01-09 09:14:21 UTC (rev 40342)
@@ -23,8 +23,20 @@
  *
  * 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
  * \return Pointer to string token



More information about the grass-commit mailing list