Wednesday, December 23, 2009

File Tab

#include"stdio.h"
int main()
{
FILE *fpRead;
char ch;
int No_tab=0;
fpRead=fopen("E://WORK//FileTab//a.txt","r");
if(fpRead==NULL)
{
printf("File cant Opened");
}else if(fpRead!=NULL)
{
printf("Opened correctly...");
}
ch=fgetc(fpRead);
while(1)
{
if(ch==EOF)
break;
if(ch=='\t')
{
No_tab++;
}
ch=fgetc( fpRead );
}
fclose(fpRead);
printf("Total Numberof Tabs in file %d",No_tab);

return 0;

}

No comments:

Post a Comment