[Solved] C++ Storing constant varibale names within a vector [closed]


Simply use a new local variable inside your reading loop like this:

    while(stream >> token)
    {
        
        if(token == "#define")
        {
        constantVariable addconstant;
        stream >> token;
        addconstant.constantName = token;
        stream >> token;
        addconstant.constantValue = token;
        constant.push_back(addconstant);
        }
    }

But take care with checking the input stream. It should not be done as easy as you did it… but that is another question.

0

solved C++ Storing constant varibale names within a vector [closed]