#include <stdio.h>
#include <conio.h>
void main(void)
{
int i,n;
FILE *fp;
char name[15];
clrscr();
printf("Program on Creation of a Text File\n");
printf("\nEnter how many Names you want to store : ");
scanf("%d",&n);
printf("\nEnter %d names : ",n);
flushall();
fp = fopen("one.txt","w");
for (i=1;i<=n;i++)
{
gets(name);
fputs(name,fp);
fputs("\n",fp);
}
printf("\n The file \"one.txt\" is created");
fclose(fp);
printf("\nPress any key to end...");
getch();
}
#include <conio.h>
void main(void)
{
int i,n;
FILE *fp;
char name[15];
clrscr();
printf("Program on Creation of a Text File\n");
printf("\nEnter how many Names you want to store : ");
scanf("%d",&n);
printf("\nEnter %d names : ",n);
flushall();
fp = fopen("one.txt","w");
for (i=1;i<=n;i++)
{
gets(name);
fputs(name,fp);
fputs("\n",fp);
}
printf("\n The file \"one.txt\" is created");
fclose(fp);
printf("\nPress any key to end...");
getch();
}
No comments:
Post a Comment