Reading string from a file
#include"stdio.h"
void main()
{
char str[70];
FILE *p;
clrscr();
if((p=fopen("string.txt","r"))==NULL)
{
printf("\nUnable t open file string.txt");
exit(1);
}
while(fgets(str,70,p)!=NULL)
puts(str);
fclose(p);
}
#include"stdio.h"
void main()
{
char str[70];
FILE *p;
clrscr();
if((p=fopen("string.txt","r"))==NULL)
{
printf("\nUnable t open file string.txt");
exit(1);
}
while(fgets(str,70,p)!=NULL)
puts(str);
fclose(p);
}
Posted by Naresh Kumar at 6:45 AM
Labels: Read string from file
0 comments:
Post a Comment