I keep getting segmentation fault core dumped error when trying to read a text file and store it in a string, is there a way in C++ where I can store it in a string without using vectors?
void readMazeStdin2(Maze maze) {
    std::string x = " ";
    char c;
    while (!cin.eof()) {
        c = std::cin.get();
        if (c == '.' || c == '=' || c == 'S' || c == 'E') {
            x += c;
        }
        cout << c;
    }
    cout << x;
}
