Thread: How does strtok work? Please explain..

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    63

    Question How does strtok work? Please explain..

    umm..back again..don't think you guys mind me asking so many questions but I am trying to ensure that I get a deep understanding of strings..
    could someone please explain how strtok works? I am just reading my college txt book and must say the explanation is confusing..so it would be great if someone helped me out..Thanks..Please answer only if you're relatively confident of your answer..
    Thanks
    A

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Have a look at this. It's a reasonably good appraisal of strtok() with an example.

    If you're still stuck, post and ask again.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Hmm, perhaps a board search would give better examples. Generally I don't trust examples that use void main, this one is okay, but still makes me a bit edgy about how much the author really knows.

    -Prelude
    My best code is written with the delete key.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >Generally I don't trust examples that use void main, this one is okay, but still makes me a bit edgy about how much the author really knows.
    You're right.. I have found it difficult though to find a reference site that explains everything clearly, and contains example code that is 100%
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I have found it difficult though to find a reference site that
    >explains everything clearly, and contains example code that is 100%
    Precisely why I recommend learning from decent books as opposed to questionable web sites. There are plenty of questionable books, but at least the questions are well documented on sites such as www.accu.org.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 20q game problems
    By Nexus-ZERO in forum C Programming
    Replies: 24
    Last Post: 12-17-2008, 05:48 PM
  2. strtok is causing segmentation fault
    By yougene in forum C Programming
    Replies: 11
    Last Post: 03-08-2008, 10:32 AM
  3. Problems in getting OpenGL to work
    By zonf in forum C Programming
    Replies: 5
    Last Post: 02-13-2006, 04:48 AM
  4. Engines; how do they work?
    By cboard_member in forum Game Programming
    Replies: 3
    Last Post: 12-05-2005, 12:43 AM
  5. Can someone explain this to me plz...
    By CAP in forum C Programming
    Replies: 3
    Last Post: 07-23-2002, 01:30 PM