C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: strtok - String Function Posted by tsagld on 31 Mar 2006 at 1:49 AM
: Hi
:
: Another question on String Function, strtok.
:
: For strtok, here is the explanation, http://www.cplusplus.com/ref/cstring/strtok.html
: and my question follows in blue[/blue]
:
: Summerize what they say... is this simply to separate delimiter from other deliminater...? Then, is using while the only way to see its result...?
:
: This is the trial code introduced on the site above;
:
: /* strtok example */
: #include <stdio.h>
: #include <string.h>
: 
: int main ()
: {
:   char str[] ="This is a sample string,just testing.";
:   char * pch;
:   printf ("Splitting string \"%s\" in tokens:\n",str);
:   pch = strtok (str," ");
:   while (pch != NULL)
:   {
:     printf ("%s\n",pch);
:     pch = strtok (NULL, " ,.");
:   }
:   return 0;
: }
: 

:
: Output
: Splitting string "This is a sample string,just testing." in tokens:
: This
: is
: a
: sample
: string
: just
: testing
:


Correct.


Greets,
Eric Goldstein
www.gvh-maatwerk.nl

Thread Tree
tokoG strtok - String Function on 31 Mar 2006 at 12:01 AM
tsagld Re: strtok - String Function on 31 Mar 2006 at 1:49 AM
tokoG Re: strtok - String Function on 31 Mar 2006 at 9:01 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.