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