#include
#include
using namespace std;
int main()
{
int count=0;
FILE *fp;
if((fp=fopen("c:\\users\\lulu\\desktop\\test2.cpp","r"))==NULL)
{
printf("file open error!\n");
exit(-1);
}
char bufline[1024]={0};
char func[100];
while(!feof(fp))
{
fgets(bufline,1024,fp);
if(bufline==NULL)
break;
int i=0,len=strlen(bufline);
char *startpos=bufline;
while(startpos
char *left=strchr(startpos,'(');
if(left==NULL)
break;
char *t=left-1;
while(t>=bufline)
{
if(!(isdigit(*t)||isalpha(*t)))
break;
t--;
}
if(strncmp(t+1,"for",left-t-1)==0||//这些都不是函数名
strncmp(t+1,"while",left-t-1)==0||
strncmp(t+1,"if",left-t-1)==0||
strncmp(t+1,"sizeof",left-t-1)==0);
else
{
memset(func,0,sizeof(func));
strncpy(func,t+1,left-t-1);
printf("%s\n",func);
}
startpos=left+1;
}
memset(bufline,0,sizeof(bufline));
}
fclose(fp);
system("pause");
return 0;
}//这段代码能够把所有用到的函数都找出来,并显示出来,至于你说的统计这些还是自己完成吧!