Ive been very stuck on this for a few hours now. I have code that processes a txt file word by word and hashes the input.
However I cant even get my code to open the txt file. I have used both eclipse and visual studio, I made sure the txt file is within the same folder as the other files and in VS I added it to the project. For some reason it works only on visual studio and only with 1 of my 4 files. I think this 1 file started working after I copied the contents to another file for some reason. I recive no errors or warning when building but I keep getting the eroor “Error opening file.” in eclipse and in VS it just crashes. PLS HELP Let me know if you need any context I really appreciate the help.
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <sstream>
#include "HashType - Copy.h"
using namespace std;
int main() {
for (int b : {33, 37, 39, 41}) {
ifstream inFile("hashText1.txt");
if (!inFile) {
cerr << "Error opening file." << endl;
return 1;
}
int primeSize;
string line;
if (getline(inFile, line)) {
stringstream ss(line);
ss >> primeSize;
}
HashType<string> hashTable(primeSize);
buildHashTable(inFile, hashTable, 1, b);
}
return 0;
}
As I mentioned it works only with 1 file and only in VS but not at all with any other files or at all in eclipse!
Jhgg Fvubh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.