So... I'm making a chatbot program to familiarize myself with the functions in <stdio.h>... it uses fnmatch, getc, fopen, and stuff like that... but I had a question: what's the best way to organize the data file? It holds patterns to match, like "Hello*.", and responses to those patterns, like ">>Hi.". Here's what it looks like, basically:
(The ">>" is just to differentiate between patterns and responses.)Code:Hello*.
>>Hi.
How are you*?
>>Peachy.
*
>>What?
So all I have to do here is check every other line with fnmatch() and if it matches, I get the next line and display it.
I'm not concerned with finding the best match, I can do that on my own time. Just the speed with which I find a match.