STRSEP(3) 1990 STRSEP(3) NNAAMMEE strsep - separate strings SSYYNNOOPPSSIISS ##iinncclluuddee <<ssttrriinngg..hh>> cchhaarr ** ssttrrsseepp((cchhaarr ****ssttrriinnggpp,, cchhaarr **ddeelliimm));; DDEESSCCRRIIPPTTIIOONN SSttrrsseepp locates in the null-terminated string at *_s_t_r_i_n_g_p the first occurence of any character in _d_e_l_i_m and replaces this with a '\0', records the location of the immediate following character in *_s_t_r_i_n_g_p, then returns the original value of *_s_t_r_i_n_g_p. If no delimiter characters are found, ssttrrsseepp sets *_s_t_r_i_n_g_p to NULL; if *_s_t_r_i_n_g_p is initially NULL, ssttrrsseepp returns NULL. EEXXAAMMPPLLEESS The following uses _s_t_r_s_e_p to parse strings containing runs of white space, making up an argument vector: char inputstring[100]; char **argv[51], **ap = argv, *p, *val; /* _s_e_t _u_p _i_n_p_u_t_s_t_r_i_n_g */ for (p = inputstring; p != NULL; ) { while ((val = strsep(&p, " \t")) != NULL && *val == '\0'); *ap++ = val; } *ap = 0; Printed 7/27/90 May 1