Question 13.6

How can I split up a string into whitespace-separated fields?
How can I duplicate the process by which main() is handed argc and argv?


The only Standard routine available for this kind of ``tokenizing'' is strtok, although it can be tricky to use and it may not do everything you want it to. (For instance, it does not handle quoting.)

References: K&R2 Sec. B3 p. 250
ANSI Sec. 4.11.5.8
ISO Sec. 7.11.5.8
H&S Sec. 13.7 pp. 333-4
PCS p. 178


Read sequentially: prev next up top


This page by Steve Summit // Copyright 1995 // mail feedback