I have complete project in C, which can be built with gcc or Visual Studio. There are no calls to external libraries.
I would like to know how many functions there
i have an idea to count the functions .c file.. wecan count this .java file also. this is c# class file and you can pass the file to the the class
class CountFunctions
{
private FileInfo File;
private int functions = 0;
public int getNumberOfFunctions
{
get { return functions; }
}
public countfunctions(FileInfo fs) {
File = fs;
getLineOfCode();
}
private void getLineOfCode()
{
string line;
try
{
StreamReader reader = File1.OpenText();
while (true)
{
line = reader.ReadLine();
if (IsFunction(line))
{
Functions++;
}
if (line == null)
break;
}
}
catch (Exception r)
{
Console.WriteLine(r.Message);
}
}
private bool IsFunction(string line)
{
if (line.Contains("void") || line.Contains("int") || line.Contains("short") || line.Contains("long") || line.Contains("float") || line.Contains("char") || line.Contains("double"))
{
if (!line.Contains(";"))
{
return true;
}
}
return false;
}
}