>>31 #include<stdio.h>
void moji_line_count(const char *filename){
FILE *fp;
int prev='\n', moji, moji_count=0, line_count=0;
if((fp=fopen(filename, "rb"))==NULL) return;
for(;(moji=fgetc(fp))!=EOF;prev=moji,moji_count++) if(moji=='\n') line_count++;
fclose(fp);
if(prev!='\n') line_count++;
printf("File : %s\nCharacter count : %d\nLine count : %d\n\n", filename, moji_count, line_count);
}
int main(int argc, char *argv[]){
int i;
for(i=1;i<argc;i++) moji_line_count(argv[i]);
return 0;
}