/*Serial No.110 [swami87.cpp]*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
char ch;
clrscr();
FILE *fp1;
fp1=fopen("swami1.dat","r");
if(fp1==NULL)
{
printf("file doesn't exist");
getch();
fclose(fp1);
exit;
}
printf("Contents of file are:\n\n");
while(1)
{
ch=fgetc(fp1);
if(ch==EOF)
break;
else
printf("%c",ch);
}
getch();
}
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
char ch;
clrscr();
FILE *fp1;
fp1=fopen("swami1.dat","r");
if(fp1==NULL)
{
printf("file doesn't exist");
getch();
fclose(fp1);
exit;
}
printf("Contents of file are:\n\n");
while(1)
{
ch=fgetc(fp1);
if(ch==EOF)
break;
else
printf("%c",ch);
}
getch();
}
No comments:
Post a Comment
If you have any doubt, feel free to ask...