Advertisement
adgiczone

pointer priority

Apr 25th, 2019
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. void calibrate::init_coeff(int type, double ***mapOut)
  2. {
  3.     tstring coeffSectionName = _T("");
  4.     tstring stageSectionName = _T("");
  5.     switch (type)
  6.     {
  7.     case 0:
  8.         stageSectionName = _T("TemperatureStage");
  9.         coeffSectionName = _T("TemperatureCoeff");
  10.         break;
  11.     case 1:
  12.         stageSectionName = _T("NonLinerStage");
  13.         coeffSectionName = _T("NonLinerCoeff");
  14.         break;
  15.     }
  16.     TCHAR* pBuf = new TCHAR[1024];
  17.     int dwSize = GetPrivateProfileString(stageSectionName.c_str(), NULL, _T(""), pBuf, 1024, _strConfigFile.c_str());
  18.     int iStageCount = std::count(pBuf, pBuf + dwSize, _T('\0'));
  19.     *mapOut = new double*[iStageCount];//
  20.     int powerNum = 5;
  21.     for (int u = 0; u < iStageCount; ++u)
  22.     {
  23.         (*mapOut)[u] = new double[powerNum + 1];
  24.         tstring keyName = _T("coeff")+to_tstring(u)+_T("_");
  25.         tstring stageName = _T("stage_") + to_tstring(u);
  26.         for (int v = 0; v < powerNum + 1; ++v)
  27.         {
  28.             TCHAR sz[64] = { 0 };
  29.             GetPrivateProfileString(coeffSectionName.c_str(), (keyName + to_tstring(v)).c_str(), _T(""), sz, 64, _strConfigFile.c_str());
  30.             (*mapOut)[u][v] = _ttof(sz);
  31.             ListOut(_T("%s coeff_%d:%s"), coeffSectionName.c_str(), u, sz);
  32.         }
  33.     }
  34.     delete[] pBuf;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement