#include<stdio.h>
#include<conio.h>
#include<process.h>
void
main()
{
FILE *fp;
char x;
int count=0;
clrscr();
fp=fopen("f:/ds/f1.txt","r");
if(fp==NULL)
{
printf("Error!!!!");
exit(0);
}
x=fgetc(fp);
while(x!=EOF)
{
if(x=='\n')
{
++count;
}
x=fgetc(fp);
}
printf("no of lines are :
%d",count);
fclose(fp);
getch();
}
No comments:
Post a Comment