Searching through strings
Posted on 2004-10-13
I have 8 different scenarios. If the user selects the first option, I hvae to search through the names of the 5 group1 files...if the 2nd option is selected, I have to search through the names of group2 files...etc
I currently have a switch statement to handle which option is selected. But I am trying to determine, rather than having a separate search handler for each one....how would I handle the searching....? I have 8 separate char* arrays (which I could change to something else...)
I was thinking about, for example, if option 1 is selected, then store the char* array into a generic char* array which can then be used for searching after the switch statement to avoid having 8 different search loops.
Then I was told that copying arrays is not very efficient and it may be best to use vectors??