I have this dictionary project that's making my head spin. Am trying to create a dictionary that stores the word and meaning of the word in a text file. Then a user can either searching the meaning of a word or search by alphabet.
I had an idea which is, i wanted to use a function that searches for a specific string in a text file but i dont know how. I hope this is all not too confusing.
please help.
Thanks in advance.
kazek
0
Newbie Poster
Recommended Answers
Jump to Postsearching a file for a specific string is fairly straight forward. Open the file, read each line and search the lines for desired string. use std::ifstream object for the file, getline() to read each line into a std::string object, the use the string's find() method to see if it contains …
Jump to PostI can answer that one. :) I was just looking at this not too long ago. It's a good reference.
Jump to Post> What's the syntax for the string's find method
Look it up, that's what google is for.
Jump to Post>>What's the syntax for the string's find method
It only has one parameter -- the string you want to look for. It returns either string::npos when the string is not found or the index where it starts.
All 15 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
kazek
0
Newbie Poster
Hamrick
150
Posting Whiz
iamthwee
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
kazek
0
Newbie Poster
kazek
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
kazek
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
kazek
0
Newbie Poster
Bench
212
Posting Pro
iamthwee
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
kazek
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.