title: How do i remove the white spaces in my text file using c program
body: <p>How do i remove the white spaces in my text file ? The reason to work behind it, my colleague,  he has lots of text files with huge amount of white spaces between them. Its getting harder for him to remove them by hitting backspace.So what i planned is to write a code to that.And i was successful upto 99%. Check up the below code that i have written.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
      int b;
      char array[100];
      gets(array); \\ file name to be given here
      FILE *P;
      FILE *T;
      P=fopen(array,"r");
      T=fopen("./duplicate.txt","w");
      for(;(b=getc(P))!=EOF;)
      {
          if(b==32)
          {
              fputc(b,T);
              me:
              b=getc(P);
              if(b==32)
              goto me;
          }
          fputc(b,T);
      }
  }
  </code></pre>
  
  <p>The code working perfect but the thing I did it, by creating a duplicate of original text file.But i dont want to make duplicate , I want to rewrite to the original file itself. I tried it to the original text file.But some where its going wrong.</p>
  
  <p>I have the algorithm how to approach it like saving the strings and writing them back to file but i think that is not the efficient approach. And guys i have a doubt </p>
  
  <pre><code>fputs("\b",filepointer);
  </code></pre>
  
  <p>will these create a backspace I suppose no is the answer. because its writing the backspace character not performing the backspace operation.But i think there is a function ungetc() will it work here.Any ideas would be rewarded.Thank you</p>