Spaces into tab characters

This is a discussion on Spaces into tab characters within the C Programming forums, part of the General Programming Boards category; Code: #include <stdio.h> int main () { int inChar; while ((inChar=getchar() ) != EOF{ putchar(inChar); } } how can i ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    3

    Unhappy Spaces into tab characters

    Code:
    #include <stdio.h>
    
    int main () {
    int inChar;
    while ((inChar=getchar() ) != EOF{
                                       putchar(inChar);
                   }
    }
    how can i write a n altered code to expand spaces into tab characters.....

    PLS HELP ME

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    Code:
    #include <stdio.h>
    
    int main () {
    int inChar;
    while ((inChar=getchar() ) != EOF)
    {
        if(inChar == ' ')
            putchar('\t');
        else
            putchar(inChar);
    }
    }
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 04:45 PM
  2. Replies: 4
    Last Post: 10-14-2005, 01:53 PM
  3. How to count characters, but not spaces?
    By RedZippo in forum C++ Programming
    Replies: 17
    Last Post: 03-29-2004, 05:09 PM
  4. Visual C++
    By Golffor1 in forum C++ Programming
    Replies: 1
    Last Post: 08-04-2003, 05:30 PM
  5. Replies: 5
    Last Post: 06-30-2003, 01:52 PM

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