Searching/seeking in a text file
Heya all.
I'm working on a game where I've come the need to have the ability to search in a text file for a specific character, and then have the file pointer point to that character, like oh say the '[' one. I looked into seekg and had really weird results, any suggestions? Sorry if this question has been asked before, but the tutorials over at gametutorials.com didn't seem to have the right answer, and neither did a search over here on the forums. Thanks!
[edited by - Enokh on October 10, 2003 8:52:02 PM]
Hmm say, wouldn't inputting word by word into strings and checking the first letter of the string be more efficient though than searching char by char?
[edited by - Enokh on October 11, 2003 7:52:14 AM]
[edited by - Enokh on October 11, 2003 7:52:14 AM]
quote:
Hmm say, wouldn''t inputting word by word into strings and checking the first letter of the string be more efficient though than searching char by char?
[/quote[
It would be less efficient because reading it in a word at a time is basically doing the same thing (reading in 1 char at a time), but it also has to check for whitespace and you have to store the string.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement