Strtok and CodeBlocks debugging

This is a discussion on Strtok and CodeBlocks debugging within the C Programming forums, part of the General Programming Boards category; Just wondering if there is a way i can use CodeBlocks debugger to display all the tokens in 'tokens' if ...

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    53

    Strtok and CodeBlocks debugging

    Just wondering if there is a way i can use CodeBlocks debugger to display all the tokens in 'tokens' if i setup strtok as

    Code:
    tokens = strtok (linebuffer, delims);

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    What do you mean? Just set up watches for variables and step through the program using the debugger and it should tell you what the variable contains.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Registered User
    Join Date
    May 2011
    Posts
    53
    Yeh i realise that, but i was just wondering if there was a way to see all tokens at once. Not one after another. Np i have fixed my bug. It seems that the values are stored Globally so you can't have two token list at the same time.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by TonyG View Post
    Yeh i realise that, but i was just wondering if there was a way to see all tokens at once. Not one after another. Np i have fixed my bug. It seems that the values are stored Globally so you can't have two token list at the same time.
    It might help if you were using strtok() correctly... read the instructions in your compiler's library documentation...
    I believe you will find that you are to use it the first time on a string in one way then a different way for the rest of the string.
    Last edited by CommonTater; 05-15-2011 at 02:52 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using codeblocks
    By torquemada in forum Tech Board
    Replies: 7
    Last Post: 04-20-2011, 08:57 PM
  2. Roulette in Codeblocks 10.5
    By Parid in forum C Programming
    Replies: 11
    Last Post: 12-19-2010, 12:53 PM
  3. gcc vs CodeBlocks compiler
    By CDdotdot47 in forum C Programming
    Replies: 8
    Last Post: 08-13-2010, 12:43 PM
  4. Codeblocks.
    By Kitt3n in forum C++ Programming
    Replies: 5
    Last Post: 05-16-2010, 01:50 PM
  5. need help, using/setting up codeblocks
    By xBlAzEx in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2009, 06:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21