All pastes #351499 Raw Edit

Something

public c v1 · immutable
·published 2007-02-12 05:37 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>int main(){	int numWords = 0;	int numLines = 0;	int numBytes = 0;	int currLocation = 0;	//char *buff = (char*) malloc(sizeof(char)*128);	//char *myStream = (char*) malloc(sizeof(char)*4096);	char buff[128];	char myStream[4096];	printf("Please enter file name:: ");	scanf("%s", &buff);		myStream = fopen(buff, "r");		while(myStream[currLocation] != NULL)	{		if(myStream[currLocation] == ' ')			numWords = numWords+1;		else if(myStream[currLocation] == '\n')			numLines = numLines+ 1;	}		printf("Number of words = %d", numWords);	printf("Number of lines = %d", numLines);				return 0;}