| | |
Segmentation Fault Reading File Into Hash Table
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 25
Reputation:
Solved Threads: 0
I'm writing a spellchecking program using a hash table. The hash table (a char * array) serves as the dictionary, storing words inputted from a file. However, a segmentation fault occurs before I can get through reading, hashing, and inserting all 60,389 words (the words are in alphabetical order, and the fault occurs after "reloads"). Any suggestions on how to figure out where the segmentation fault is coming from would be greatly appreciated.
The attached files:
1. spellcheck.cpp contains the main function, calling the Dictionary class member function "add" on every word in the file wordlist.txt.
2. hashTable.cpp contains definitions for functions in the Dictionary class. The "add" and "getIndex" functions are the only ones that are functional right now.
3. hashTable.h contains declarations.
4. wordlist.txt contains all the words that need to go in the dictionary.
5. input.txt is the input to the program, but isn't actually being used for anything yet.
The attached files:
1. spellcheck.cpp contains the main function, calling the Dictionary class member function "add" on every word in the file wordlist.txt.
2. hashTable.cpp contains definitions for functions in the Dictionary class. The "add" and "getIndex" functions are the only ones that are functional right now.
3. hashTable.h contains declarations.
4. wordlist.txt contains all the words that need to go in the dictionary.
5. input.txt is the input to the program, but isn't actually being used for anything yet.
![]() |
Similar Threads
- Reading txt file into Hash Table (C++)
- Segmentation fault (C++)
- Segmentation Fault while Compressing File (Getting Started and Choosing a Distro)
- Reading from file, passing into function. (C)
- Help with finding a good use for a hash table in my program.... (C++)
- segmentation fault in reading file (C)
- Conversion of CSV file to hash table (Perl)
- segmentation fault... boooo!!!! (C++)
- Pass XML file contents to a hash table. (Java)
Other Threads in the C++ Forum
- Previous Thread: C2446 Error for simple text based adventure
- Next Thread: C++ Can anyone help me with this program?
| Thread Tools | Search this Thread |
api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





