I'm trying to code a program for class that basically functions as a search program for a dictionary file. While debugging I managed to get rid of the entire list of errors and warnings that Unix was giving me, and it's apparently compiling, but when I go to run it, I get a Bus Error (which I have never encountered before, have never even heard of before now, and searching through the internet hasn't helped me understand what's going on any).
There's three files for the code. A class definition file, a class implementation file, and the main program. If anyone could even just point me in the direction of how to make this work, I would be grateful.
wordList is passed by value to ReadFromFile so changes to wordList in ReadFromFile will not affect wordList in main. Pass the Dictionary by reference instead.
When you are adding words in the loop you will add one word too many. The stream will not be in an error state until a read operation has failed which will be checked after the word has been added to the list. Something like this should work better:
Thanks kindof. I implemented both of those changes, but now I'm getting a segmentation fault, and I still can't seem to find the problem...
(Edit)
Wait, I think I might know what I did wrong, though I don't know how to do it. There's an array of struct objects in the class, and admittedly, I have no idea how to access that.