Thread: question about strings

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    19

    question about strings

    hi, im trying to change all my punctuation characters and space into \0 so i can get a word at a time from the entire string. however, i may get results like \0\0\0\0\0\helloword\0 is the front of helloworld is spaces. any advice? thanks

    Code:
    while fget(Buffer, 200, myfile){
     for(i =0; i <= strlen(Buffer); i++) {
                if(isspace(Buffer[i]) || ispunct(Buffer[i])) {
                    continue;
                } else {
                    tempBuffer[loopCount] = Buffer[i];
                    loopCount++;
                }
            }
            loopCount = 0; /* reset counter.. */
     ...........
    ..........printf("&#37;s", tempBuffer);  //display string terminated by \0
    }
    Last edited by norhos; 03-18-2008 at 01:41 PM.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    this will not even compile
    what about posting code using copy-paste?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about strings in c
    By gp364481 in forum C Programming
    Replies: 9
    Last Post: 11-13-2008, 06:32 PM
  2. Question About Strings
    By spanker in forum C++ Programming
    Replies: 1
    Last Post: 07-13-2008, 05:09 AM
  3. strings question
    By cstudent in forum C Programming
    Replies: 4
    Last Post: 04-18-2008, 07:28 AM
  4. Functions and Strings Question
    By StrikeMech in forum C Programming
    Replies: 4
    Last Post: 07-18-2007, 06:07 AM
  5. Strings question
    By kimimaro in forum C Programming
    Replies: 10
    Last Post: 03-15-2005, 12:14 AM