/* C Program => File Handeling
Calibre IT & Management Institute
[ Krishna suman ]
*/
#include<stdio.h>
void main()
{
FILE *file1;
char c;
int choice;
char op;
clrscr();
do
{
printf("\t\tMenu\n\t1. Enter The Information\n\t2. Display The Information\n");
printf("\n \t Enter Your Choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\n\t\t\t Information \n");
file1=fopen("Krishna.doc", "w");
while((c=getchar())!=EOF)
{
putc(c,file1);
}
fclose(file1);
break;
case 2:
printf("\n\t\t\t Information\n");
printf("\nResult :");
file1=fopen("Krishna.doc", "r");
while((c=getc(file1))!=EOF )
printf("%c",c);
fclose(file1);
break;
default:
exit(1);
}
printf("Enter Y To Continue:");
flushall();
scanf("%c",&op);
}while(op=='y' || op=='Y');
getch();
}
Calibre IT & Management Institute
[ Krishna suman ]
*/
#include<stdio.h>
void main()
{
FILE *file1;
char c;
int choice;
char op;
clrscr();
do
{
printf("\t\tMenu\n\t1. Enter The Information\n\t2. Display The Information\n");
printf("\n \t Enter Your Choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\n\t\t\t Information \n");
file1=fopen("Krishna.doc",
while((c=getchar())!=EOF)
{
putc(c,file1);
}
fclose(file1);
break;
case 2:
printf("\n\t\t\t Information\n");
printf("\nResult :");
file1=fopen("Krishna.doc",
while((c=getc(file1))!=EOF
printf("%c",c);
fclose(file1);
break;
default:
exit(1);
}
printf("Enter Y To Continue:");
flushall();
scanf("%c",&op);
}while(op=='y' || op=='Y');
getch();
}


No comments:
Post a Comment