I need to read a file one word at a time. When I read the word it needs to be stored in a char* so I can pass it into my hash function. Whenever I try getline or infile>> my program just crashes. could someone please tell me what I need to use for this?
matt611
0
Newbie Poster
Recommended Answers
Jump to Post>could someone please tell me what I need to use for this?
Something besides char* because you obviously don't know what you're doing. I'd suggest using the string class, then you can use the c_str member function to get a pointer to const char for your hash function.
Jump to PostDo you know what a std::string is?
Jump to PostCan you post your code along with a sample of your input file.
All 9 Replies
Narue
5,707
Bad Cop
Team Colleague
matt611
0
Newbie Poster
iamthwee
matt611
0
Newbie Poster
iamthwee
matt611
0
Newbie Poster
matt611
0
Newbie Poster
ravenous
266
Posting Pro in Training
ravenous
266
Posting Pro in Training
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.