Pages

Write a program to get data from user and write into a file in c language.

Friday 19 April 2013

#include <stdio.h>

#include <conio.h>
int main()
{
         again:
         FILE *fp;
         fp=fopen("g.txt", "a+");
         char a;
         a=getche();    
         while(a!='.')
         {
                      fputc(a, fp);
                       a=getche();        
                 
         }
         fprintf(fp, "\n");
         printf("\nPrograme is ended, would you like to input again? y/n: ");
         a=getch();
         if(a == 'y' || a == 'Y')
         {
              printf("\n");
                goto again;  
         }
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *