question about strings

This is a discussion on question about strings within the C Programming forums, part of the General Programming Boards category; hi, im trying to change all my punctuation characters and space into

Thread: question about strings

so i can get a word at ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,474
    this will not even compile
    what about posting code using copy-paste?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

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, 05: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-14-2005, 11:14 PM

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