[Solved] extract specific string from a file using c++


This sounds like a task for regular expression. In C++ there is support for regex especially regex_match.
I guess, this should get you started. But be warned, what you are trying to accomplish will not be solved by simple regex.
Your matching string might look something like this

/\/function name: ([^\\]*).*/

This will look for string “function name: ” followed by any character other than \ . and then any character up to the end of the line. The second part will be remembered and can be accessed by regex_match.

Try it in online regex tester and modify it based on your specific needs. Just note that it takes regex without leading and ending /.

Oh, I noticed that you asked also for extracting workings, while my example extracts only function names. But you will get there when you get the concept.

solved extract specific string from a file using c++