#include
int main ()
{
FILE *file;
char c;
int n = 0;
file = fopen("my.txt", "r");
if (file==NULL)
perror ("Error reading file");
else
{
do {
c = getc (file);
if (c == '$')
n++;
} while (c != EOF);
fclose (file);
printf ("my.txt contains %d $.\n",n);
}
return 0;
}