Thread: /*word wrap*/

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    1

    /*word wrap*/

    Code:
    #include<stdio.h>
    int isspace(int);
    int main()
    {
        int len;
        int i,a=0;
    char s[] = "Cat jumped over the moon. Does this work ? its cool n wonderful";
        printf("%s \n",s);
      printf("\n enter the no chars u want in a line:\n");
      scanf("%d",&i);
      int linechars = i;    
      len=strlen(s);
    
      for(;i<=len;) {     
    
        // Read i chars    
        while(i!=0 && i<=len) 
        {
          if(isspace(s[i]))
          {
                 s[i]='\n';
             break;       
          }
          
          i--;    
        }
        i += (linechars);
            
      }
        printf("%s \n",s);    
        return 0;
    }
    
    int isspace( int i)
    {
        if(i==' ')
          return 1;
        else 
          return 0;
    }

  2. #2
    Registered User
    Join Date
    Oct 2011
    Location
    Denmark
    Posts
    80
    And your question is?
    HomePort : A C Web Service API for heterogeneous home automation systems

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Word Wrap
    By Fireblade2006 in forum C++ Programming
    Replies: 2
    Last Post: 02-27-2006, 03:09 PM
  2. Word wrap
    By Orrill in forum C++ Programming
    Replies: 6
    Last Post: 10-14-2005, 02:00 PM
  3. Word Wrap
    By sethjackson in forum Windows Programming
    Replies: 4
    Last Post: 09-21-2005, 04:35 PM
  4. Word Wrap
    By osal in forum Windows Programming
    Replies: 4
    Last Post: 07-02-2004, 11:16 AM
  5. word wrap
    By max in forum C Programming
    Replies: 6
    Last Post: 08-24-2002, 10:44 AM

Tags for this Thread