-
/******************************************************************************
-
*
-
* FUNCTION: Split
-
*
-
* PURPOSE: Split a delimited line into components
-
*
-
******************************************************************************/
-
int Split ( char * line, char delimiter, char * items [ ] )
-
{
-
int cnt = 0;
-
-
for (;; ) {
-
// Add prefix to list of components
-
items [cnt++ ] = line;
-
-
// Check for more components
-
line = strchr ( line, delimiter );
-
if ( line == NULL )
-
return cnt;
-
-
// Terminate previous component and move to next
-
*line++ = '\\0';
-
}
-
}
转载于:https://www.cnblogs.com/zruo/archive/2010/02/10/1667136.html