I have to read a c code and analyze the code. For example, the number of functions in the code, such as the number of operators. I tried a lots but I'm very new in the Java programming language, i didn't happen. I read a lot of topics, tried to do it with the scanner class, but it didn't happen. Can you help me?
public static void main(String[] args) throws IOException
{
File file = new File("C:\\main.c");
FileInputStream fileStream = new FileInputStream(file);
InputStreamReader input = new InputStreamReader(fileStream);
BufferedReader reader = new BufferedReader(input);
String line;
while((line = reader.readLine()) != null)
{
String[] operatorsNumbers=line.split("+");
int operators=operatorsNumbers.length;
}
System.out.println("number of operators" + operators );
}