If you want to process multiple capture files within one invocation of your program, you will need to modify TShark so that, for example, its version of cf_close() does all the necessary work that the Wireshark version, in file.c does, and probably other changes, and then take the part of the main function that reads and processes the file, make it into a subroutine, and call it twice.