Skip to content

Instantly share code, notes, and snippets.

@neotyfff
Created February 3, 2013 11:04
Show Gist options
  • Save neotyfff/4701302 to your computer and use it in GitHub Desktop.
Save neotyfff/4701302 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void)
{
int count,n,searchchar;
FILE *ifp;
n=0;
count=0;
ifp=fopen("data.txt", "r");
searchchar=' ';
while(n!=EOF)
{
while((n=getc(ifp))!=searchchar && n!=EOF);
count++;
}
printf("%d \n", count);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment