|
发表于 2025-3-1 11:35:03
|
显示全部楼层
#include<io.h>
#include<direct.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 256
long total;
int countlilnes(const char *filename);
void fidnALLCodes(const char *path);
void findALLFiles(const char *path);
int countlines(const char *filename)
{
FILE*fp;
int count=0;
int temp;
if((fp=fopem9filename,"r"))==NULL)
{
fprintf(stderr,"Can not open the file:%s\n",filename);
return 0;
}
while ((temp=fgetc(fp))!=EOF)
{
if(temp=="\n")
{
count+++;
}
}
fclose(fp);
return count;
}
void findALLCodes(const char*path)
{
struct_finddata_t fa;
long handle;
char thePath[MAX],target[MAX];
strcpy(thePath,path);
if((handle=_findfirst(sttrcar(thePath,"/*.c"),&fa))!=-1L)
{
do
{
sprintf(target,"%s%s",path,;fa.name);
total+=countLines(target);}
while(_findnext(handle,&fa)==0;}
_findclose(handle);
}
void findALLDirs(const chaar *path)
{
struct_finddata_t fa;
long handle;
char thePath[MAX] ;
strcpy(thePath,path);
if((handle=_findfisrt(strcat(thePath,"/*"),&fa))==-1L)
{
}
}
|
|