All pastes #977693 Raw Edit

Someone

public c v1 · immutable
·published 2008-04-09 00:26 UTC
rendered paste body
#include <stdio.h>#include <string.h>void CountOccurences( const char *fileName, const char *theString ){	FILE *file = fopen( fileName, "r" );	if( file == NULL )	{		printf( "Can't open %c\n", &fileName );		return;	}	const int LINE_SIZE = 500;	int WordCount = 0;	char Line[ LINE_SIZE ];	while( fgets( Line, LINE_SIZE, file ) != NULL )		if( strstr( Line, theString ) != NULL )		{			++WordCount;			printf( "Found %s, %d\n", theString, WordCount );		}	fclose( file );}int main( int argc, char *argv[] ){    if( argc < 1 )	{		printf( "Usage: File Letter String " );		return 0;	}	CountOccurences( argv[1], argv[2] );    return 0;}