title: Program to read data from keyboard, write it to a file and again read the same data from the file and copy that to another file and display?
body: <p>This is what I've so far. I want the program to read data from the keyboard write it to a file called INPUT, again read the same data from the INPUT file, and copy to that
  another file and also display it on the screen.
  I don't know where did I go wrong.
  Please help me.
  Thanks in advance.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;file.h&gt;
  main()
  {
    FILE *f1,*f2;
    char c;
    printf(“data input\n\n”)
    f1 = fopen(“INPUT”, “w”);
    while((c = getchar())!=EOF)
      putc(c,f1);
    fclose(f1);
    printf(“\ndata output\n\n”)
    f1 = fopen(“INPUT”, “r”);
    while((c = getchar())!=EOF)
      putc(“%c”,c);
    fclose(f1);
    //copying f f1 data into f2
    f1=fopen(file1,”r”)
    if(f1=NULL)
    {
      printf(“no data”);
      exit(0):
    }
    f2=fopen(file2,”w”);
    if(f2=null)
    {
      printf(“cannot able to open”);
      exit(0);
    }
    while((ch==getc(f1)!=EOF)
      putc(ch,f2);
    printf(“completed”);
    fclose(f1);
    fclose(f2);
  }
  </code></pre>