Roughly speaking you have two task:
- Parse the command line (for options and arguments: the file names).
- Read the files line by line, extracting the relevant info and reporting it.
The very fact that each option must be preceded by an hyphen simplyfy task
I would suggest you reading a good tutorial on
. See, for instance Basics of File Handling in C - GeeksforGeeks