C++ solves the problem that local variables cannot be defined in case

case Operation::DeviceAuthen:
{
    std::string token = root["body"]["token"].asString();
    std::string secretKey = root["body"]["secretKey"].asString();
    std::string resultMesg = root["head"]["resMessage"].asString();
    CMyINI *myINI = new CMyINI();
    myINI->SetValue("setting", "token", token);
    myINI->SetValue("setting", "secretKey", secretKey);
    myINI->WriteINI(GetProgramDir() + "\\UserInfo.data");
    delete myINI;
}

As in the above code, just add {} after the case.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325102191&siteId=291194637