Ok worked the last one out, now I am trying to convert to a function, what is wrong with this?
Code:
//name: linecount.c
//description: counts the number of lines in a text document
//
#include <stdio.h>
#include <stdlib.h> //need for file operations?
void linecount(int,char);
void main(int argc,char *argv[])
{
linecount(int argc,char *argv[]);
}
void linecount(int argc,char *argv[])
{
int count=0,c;
FILE *ifp,*ofp;
ifp = fopen(argv[1],"r");
while((c=getc(ifp))!=EOF)
if(c=='\n')
count++;
printf("the number of lines is:%5d\n",count);
}
Cheers Mick