Announcement

Collapse
No announcement yet.

Tab to Spaces

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tab to Spaces

    Prima versione, sembra essere funzionante.
    PHP Code:
    /*
     *
     * Tab to Spaces
     *
     *
     */

    #include <st***.h>

    int main void ) {
        
        
    char c;
        
    int i,j,k;
        
        
        
    cfgetc(stdin);
        
            for (
    i=0;c!=EOF;i++){  // condizione di uscita
                
                
    if (== '\t'){ //se il carattere รจ tab
                    
                    
    j=8-(i%8); // modulo rispetto all'indice
                    
                    
    for (k=0;k<j;k++){
                        
                        
    fputc(32,stdout); // stampa degli spazi
                        
    i++;
                        
                    }
                    
    i--;
                    
                    if (
    c==10){ // verifica se bisgona resettare tutto
                        
    i=-1;
                    }
                    
                    
    cfgetc(stdin); // richiesta nuovo carattere
                    
                
    }else{
                    
                    
    fputc(c,stdout); // stampa carattare non tab
                    
                    
                    
    if (c==10){ // verifica condizione di reset
                        
    i=-1;
                    }
                    
                    
    cfgetc(stdin); // richiesta di nuovo carattere
                
    }
        
            }
     
        return 
    0;  

    | VFX Artist, C++ Programmer, HW Overclocker | Web: xgiovio.com Email: xgiovio@gmail.com Twitter: @xgiovio
Working...
X

Google Profile


My name is Giovanni Di Grezia, but people call me xgiovio.

Here is my homepage:.

I'm a VFX Artist and Software Developer.

Giovanni Di Grezia