#include <stdio.h>
#include <conio.h>
void main(void)
{
FILE *fp;
char n;
clrscr();
printf("Program on Creation of a Text File\n");
fp = fopen("two.txt","w");
printf("\nEnter the Characters [^Z to stop] : ");
while((n=getchar()) != EOF)
fputc(n,fp);
printf("\n The file \"two.txt\" is created");
fclose(fp);
getch();
printf("\nNow the file is Opened\n");
fp = fopen("two.txt","r");
while (!feof(fp))
{
n = fgetc(fp);
printf("%c ",n);
}
fclose(fp);
printf("\nPress any key to end...");
getch();
}
#include <conio.h>
void main(void)
{
FILE *fp;
char n;
clrscr();
printf("Program on Creation of a Text File\n");
fp = fopen("two.txt","w");
printf("\nEnter the Characters [^Z to stop] : ");
while((n=getchar()) != EOF)
fputc(n,fp);
printf("\n The file \"two.txt\" is created");
fclose(fp);
getch();
printf("\nNow the file is Opened\n");
fp = fopen("two.txt","r");
while (!feof(fp))
{
n = fgetc(fp);
printf("%c ",n);
}
fclose(fp);
printf("\nPress any key to end...");
getch();
}
No comments:
Post a Comment