|
On Thu, 3 Nov 2005, Hatzenbeler, Tim wrote:
If I have a list of items in a single string ie: Fred;tom;my house;horse And I wanted to quickly loop through an unknown amount of items... If there a bif or c function, that does this?
Yup. strsep() is your friend: SYNOPSIS #include <string.h> char *strsep(char **stringp, const char *delim); DESCRIPTION If *stringp is NULL, the strsep() function returns NULL and does nothing else. Otherwise, this function finds the first token in the string *stringp, where tokens are delimited by symbols in the string delim. This token is terminated with a `\0' character (by overwriting the delimiter) and *stringp is updated to point past the token. In case no delimiter was found, the token is taken to be the entire string *stringp, and *stringp is made NULL. RETURN VALUE The strsep() function returns a pointer to the token, that is, it returns the original value of *stringp. James Rich It's not the software that's free; it's you. - billyskank on Groklaw
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.