Thread: String manipulation

  1. #1
    casanova0o7
    Guest

    String manipulation

    I'm having an issue concerning the functions *strtok and strlen.
    I assumed these were the proper functions for separating words and determining their length, but since strlen cannot be used on tokens as if they were strings, I found this procedure impossible.

    There must be a possible way to apply strlen to these separate words. If anyone knows a way, please let me know.

  2. #2
    Registered User dirkduck's Avatar
    Join Date
    Aug 2001
    Posts
    428
    you could parse the string for spaces and save the parts in more strings, then do a strlen on them

  3. #3
    casanova0o7
    Guest
    The code below is my attempt to analyze a string's words (stored in the array "words") and determine which is the largest word. My problem is that I get a compiling error stating that the ">" sign in the if statement is a "signed/unsigned mismatch". What does this mean and how can I fix it?

    for ( int k = 0; k < wcount; k++)
    {
    if ( strlen(words[k]) > bignum)
    {
    bignum = strlen(words[k]);
    bigword = k;
    }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  3. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  5. string manipulation
    By SPEKTRUM in forum Linux Programming
    Replies: 3
    Last Post: 01-26-2002, 11:41 AM