Hello, I am attempting to code a program that allows the user to create what is an essence a database of monsters and their statistics. The user is supposed to be able to input the name of the monster and its statistics, and then be able to access that information by typing in the name of the monster which would bring up the stat block only for that specific monster. The user also needs to be able to access all of the monsters they've inputted even after they have closed the program and later reopened it. How do I make it so the user can access specific creatures written to the creatures file just by typing in the creature's name?
Read in the name. If the name matches what you're looking for, output the following stats that are part of the record for that monster. If not, then extract, but do not output the following stats that are part of the record for that monster. Rinse and repeat until you've exhausted the monster records or have found the one you're looking for.
OP: you'll need to have a line counter that'll read off the line number of the file where any given monster name search yields a positive result. Then you'll have to print out this line. A stylized suggestion is below, please edit it as per your needs with error checking and other conditions: