I'm doing an small Huffman compression-encryption program, and during the decompression of the file, my current getFile method (that should return the whole file as a String) ends sooner than expected, and trying to force it to read after a false-positive EOF (maybe? It's consistent with the same string) causes the program to crash.
Here's my current method:
string getFile(string route){
    ifstream reader; 
    string s=""; 
    reader.open(route); 
    if(reader.bad())return "FAILURE TO OPEN FILE"; 
    reader.read((char*)&dictionary.weight, sizeof(int)); // There's an int in the beggining
    // It describes the original ammount of chars there were in the original file. 
    while(!reader.eof()){ s+= reader.get() } 
    reader.close(); 
    return s; 
}
 
     
    