Yes, you can modify the extractComments function to write the extracted comments to a file instead of printing them on the console. You would need to open a new file for writing and use the fprintf function to write the comments to the file.