当前位置: 首页 > 工具软件 > CTP > 使用案例 >

CTP改密码

郦何平
2023-12-01
void Td::change_password(const std::string &new_password) {
  CThostFtdcUserPasswordUpdateField reqUserPasswordUpdate = {};
  strncpy(reqUserPasswordUpdate.BrokerID, m_brokerID.c_str(),
          sizeof(reqUserPasswordUpdate.BrokerID) - 1);
  strncpy(reqUserPasswordUpdate.UserID, m_userID.c_str(),
          sizeof(reqUserPasswordUpdate.UserID) - 1);
  strncpy(reqUserPasswordUpdate.OldPassword, m_password.c_str(),
          sizeof(reqUserPasswordUpdate.OldPassword) - 1);
  strncpy(reqUserPasswordUpdate.NewPassword, new_password.c_str(),
          sizeof(reqUserPasswordUpdate.NewPassword) - 1);
  m_reqID++;
  m_tdApi->ReqUserPasswordUpdate(&reqUserPasswordUpdate, m_reqID);
}

登录以后再去修改密码

 类似资料: