#include <stdio.h>
#include<conio.h>
#include<string.h> main()
{
char ch;
int count=0; FILE *fp; clrscr();
if ( (fp = fopen("vim","w")) == NULL)
{
fprintf(stderr, "Cannot open input file.\n"); getch();
return 1;
}
while ( ( ch =getchar()) != EOF )
{
putc(ch,fp); switch(ch)
{
case ’\n’:
case ’\t’:
case ’ ’:break; default : count++; break;
}
}
printf("no of characters: %d\n", count); fclose(fp);
getch();
return 0;
}
No comments:
Post a Comment