I keep getting the Unhandled exception when I try to get the first letter after using getline function.
Error:
Unhandled exception at 0x7535DB52 in Lab2 - Containers and Regex.exe: Microsoft C++ exception: std::out_of_range at memory location 0x00B5F43C.
class CodeMap
{
private:
    vector<string> code;
    vector<char> character;
public:
    CodeMap() { character.resize(11000); }
    ~CodeMap() {};
    void setChar(string filename)
    {
        string fileName = filename;
        ifstream fin;
        fin.open(fileName.c_str());
        string line = " ";
        char codeChar;
        while (!fin.eof())
        {
            getline(fin, line);
            codeChar = line.at(0);  //Unhandled exception, tried to use [] instead, still error.
        }
        fin.close();
    }
I wondered what is going on here.
Anyway to fix this?
Thanks for helping.
 
     
    