Header Ads

Hii,I am Anand Nayak.This blogger is make for specially basic programs of some language.

How To Make A File

Let's See How We Can Do It:-

#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
  {
     FILE *fp;
     char s[100];
     clrscr();
     fp=fopen("File.txt","w");
     if(fp==NULL)
     {
       printf("file cannot open");
       exit(0);
     }
     printf("Enter your name");
     gets(s);
     while(strlen(s)!=0)
     {
fputs(s,fp);
printf("enter the string\n");
gets(s);
     }
      fclose(fp);

  getch();
  }

2 comments: