home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!po.CWRU.Edu!rat
- From: rat@po.CWRU.Edu (Reza A. Tabib-Azar)
- Newsgroups: comp.lang.c
- Subject: Re: strtok
- Date: 31 Dec 1992 20:39:37 GMT
- Organization: Case Western Reserve University, Cleveland, OH (USA)
- Lines: 22
- Message-ID: <1hvlq9INNjpm@usenet.INS.CWRU.Edu>
- References: <1992Dec31.045902.2025@mcs.drexel.edu>
- Reply-To: rat@po.CWRU.Edu (Reza A. Tabib-Azar)
- NNTP-Posting-Host: slc12.ins.cwru.edu
-
-
- In a previous article, tjhendry@mcs.drexel.edu (Jonathan Hendry) says:
-
- >Hi. Could someone please email me a brief description of how to use
- >strtok()? I have read a few books, and asked my coworkers, and haven't
- >received much useful information.
- >
- >Namely, after I run it on a string once, how do I get to the next
- >part of the string?
- >
-
- You have to call it with that NULL as the string.
- token = strtok( str, ",\n " );
- token = strtok( NULL, ",\n " );
- You can call the secend line in a loop and check token to see if it is NULL,
- if it is null then you have all your tokens.
- I hope this will help.
-
- --
- main() { printf("\t\tReza A. Tabib-Azar\b\n");
- printf("Life is real, unless declared an integer.\n");
- printf("I get 'CoreDumped', therefore I am.\n", "\t\t\t\tAnonymous\n"); }
-