Consecutive Blank space Removal in C
A text file contains a bunch of characters. There are no tab characters within the file. Write a program that replaces two or more consecutive blanks by a single blank. The input from this program should come from a file whose name has been supplied via argv[1]. The output from this program should go to standard output.

Input:
Let’s	go	to	the	movies.
Output:
Let’s go to the movies.

This is what i have so far:


    #include <stdio.h>

     int main(int argc, char* argv[]){
        char line;
        FILE* fin;
        int i=0;

        fin=fopen("textfile38", "r");
        fscanf(fin,"%c",&line);
        while((i<=line || line ==' '));
        {
            if(line !=' ')
            {
               putchar(line);
               i=i+1;
            }
        else
        {
            putchar(' ');
        }
        while(line == ' ')
        {
            i=i+1;
        }
      }
      printf("%c \n", getchar());
      getchar();
      return 0;
    }


It doesn't give me an output I'm not sure what I did wrong if anyone could help me NOT just give me the answer that would be great thank you.
Consecutive Blank space Removal in C
===

A text file contains a bunch of characters. There are no tab characters within the file. Write a program that replaces two or more consecutive blanks by a single blank. The input from this program should come from a file whose name has been supplied via argv[1]. The output from this program should go to standard output.

Input:
Let’s	go	to	the	movies.
Output:
Let’s go to the movies.

This is what i have so far:


    #include <stdio.h>

     int main(int argc, char* argv[]){
        char line;
        FILE* fin;
        int i=0;

        fin=fopen("textfile38", "r");
        fscanf(fin,"%c",&line);
        while((i<=line || line ==' '));
        {
            if(line !=' ')
            {
               putchar(line);
               i=i+1;
            }
        else
        {
            putchar(' ');
        }
        while(line == ' ')
        {
            i=i+1;
        }
      }
      printf("%c \n", getchar());
      getchar();
      return 0;
    }


It doesn't give me an output I'm not sure what I did wrong if anyone could help me NOT just give me the answer that would be great thank you.