本文整理匯總了C++中A2T函數的典型用法代碼示例。如果您正苦於以下問題:C++ A2T函數的具體用法?C++ A2T怎麽用?C++ A2T使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了A2T函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: A2T
void CScanMgrDlg::InitExamData()
{
USES_CONVERSION;
m_comboSubject.ResetContent();
if (_pCurrExam_)
{
m_strExamName = A2T(_pCurrExam_->strExamName.c_str());
if (_pCurrSub_)
{
int i = 0;
int nShowSubject = -1;
for (auto pSubject : _pCurrExam_->lSubjects)
{
m_comboSubject.AddString(A2T(pSubject->strSubjName.c_str()));
int nCount = m_comboSubject.GetCount();
m_comboSubject.SetItemDataPtr(nCount - 1, pSubject);
if (_pCurrSub_ == pSubject)
nShowSubject = i;
i++;
}
m_comboSubject.SetCurSel(nShowSubject);
}
}
UpdateChildDlgInfo();
UpdateData(FALSE);
}
示例2: sprintf_s
LRESULT CLogoMarkerPropertyPage::OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
USES_CONVERSION;
HWND hThisSB = (HWND)lParam;
if (LOWORD(wParam) == SB_ENDSCROLL)
return 0; //reject spurious messages
//get position
int nPos = (int)::SendMessage(hThisSB, UDM_GETPOS, 0, 0L);
char sText[10];
if (hThisSB == m_hSpnSize)
{
sprintf_s( sText, sizeof(sText), "%.2f\0", (double)nPos);
::SetWindowText(m_hEdtSize, A2T(sText));
}
else if (hThisSB == m_hSpnXOffset)
{
sprintf_s( sText, sizeof(sText), "%+.2f\0", (double)nPos);
::SetWindowText(m_hEdtXOffset, A2T(sText));
}
else if (hThisSB == m_hSpnYOffset)
{
sprintf_s( sText, sizeof(sText), "%+.2f\0", (double)nPos);
::SetWindowText(m_hEdtYOffset, A2T(sText));
}
/* else if (hThisSB == m_hSpnAngle)
{
sprintf( sText, "%.2f\0", (double)nPos / 100);
::SetWindowText(m_hEdtSize, sText);
}*/
return 0;
}
示例3: A2T
void CPositionInquryResultMsg::ParseJSon(const char* json)
{
USES_CONVERSION;
Json::Reader reader;
Json::Value root;
if (reader.parse(json, root))
{
Error = root["errcode"].asInt();
ErrMsg = A2T(root["errmsg"].asString().c_str());
Json::Value data = root["data"];
BP = data["bp"].asDouble();
InitBp = data["init_bp"].asDouble();
ColosPl = data["close_pl"].asDouble();
TradeFee = data["trade_fee"].asDouble();
Json::Value hold = data["hold"];
for (UINT i = 0; i < hold.size(); i++)
{
Json::Value ¤t = hold[i];
CPositionData *SPositionData = new CPositionData;
PositionDatas.push_back(SPositionData);
SPositionData->StockID = A2T(current["stock_id"].asString().c_str());
SPositionData->Volume = current["volume"].asInt();
SPositionData->Amount = current["amount"].asDouble();
SPositionData->ArgPrice = current["avg_price"].asDouble();
}
}
}
示例4: sprintf
/**
* \brief connects to the channels and initiates read thread.
* \param void
* \return S_OK for success, S_FALSE for failure
*/
HRESULT CDIL_CAN_MHS::CAN_StartHardware(void)
{
USES_CONVERSION;
HRESULT hResult;
char str[100];
//VALIDATE_VALUE_RETURN_VAL(sg_bCurrState, STATE_HW_INTERFACE_SELECTED, ERR_IMPROPER_STATE);
if (!str_has_char(sg_MhsCanCfg.CanSnrStr))
sprintf(str, "Snr=%s", sg_MhsCanCfg.CanSnrStr);
else
str[0]='\0';
if (!CanDeviceOpen(0, str))
{
(void)CanSetOptions("CanTxAckEnable=1");
// **** CAN Bus Start
if (CanSetMode(0, OP_CAN_START, CAN_CMD_FIFOS_ERROR_CLEAR) >= 0)
hResult = S_OK;
else
{
hResult = S_FALSE;
sg_pIlog->vLogAMessage(A2T(__FILE__), __LINE__, _T("could not start the controller in running mode"));
}
sg_bCurrState = STATE_CONNECTED;
}
else
{
//log the error for open port failure
sg_pIlog->vLogAMessage(A2T(__FILE__), __LINE__, _T("error opening \"Tiny-CAN\" interface"));
hResult = ERR_LOAD_HW_INTERFACE;
}
return(hResult);
}
示例5: InitSearchData
void CExamInfoMgrDlg::InitSearchData()
{
std::vector<std::string> vecSub;
vecSub.push_back("全部");
std::vector<std::string> vecGrade;
vecGrade.push_back("全部");
//獲取列表中所有科目名稱信息、年級信息
int nAllExamItems = 0;
for (auto examObj : g_lExamList)
{
pEXAMINFO pExam = examObj;
for (auto subObj : examObj->lSubjects)
{
pEXAM_SUBJECT pSub = subObj;
bool bFind = false;
for (auto strSubName : vecSub)
{
if (pSub->strSubjName == strSubName)
{
bFind = true;
break;
}
}
if (!bFind && pSub->strSubjName != "")
vecSub.push_back(pSub->strSubjName);
}
bool bFindGrade = false;
for (auto strGrade : vecGrade)
{
if (pExam->strGradeName == strGrade)
{
bFindGrade = true;
break;
}
}
if (!bFindGrade && pExam->strGradeName != "")
vecGrade.push_back(pExam->strGradeName);
nAllExamItems = pExam->lSubjects.size();
}
m_nAllExamListItems = nAllExamItems;
m_comboSubject.ResetContent();
m_comboGrade.ResetContent();
USES_CONVERSION;
for (auto strSubName : vecSub)
m_comboSubject.AddString(A2T(strSubName.c_str()));
for (auto strGrade : vecGrade)
m_comboGrade.AddString(A2T(strGrade.c_str()));
m_comboSubject.AdjustDroppedWidth();
m_comboGrade.AdjustDroppedWidth();
m_comboSubject.SetCurSel(0);
m_comboGrade.SetCurSel(0);
}
示例6: testFramework
int Matrix_T::transposeTest(void)
{
TestUtil testFramework("Matrix", "Transpose", __FILE__, __LINE__);
gpstk::Matrix<double> A1T(2,2),A2T(3,3),A3T(4,4),A4T(4,5);
gpstk::Matrix<double> CompareA1T(2,2),CompareA2T(3,3),CompareA3T(4,4),CompareA4T(5,4);
A1T = gpstk::transpose(A1);
A2T = gpstk::transpose(A2);
A3T = gpstk::transpose(A3);
A4T = gpstk::transpose(A4);
double temp4[4] = {2,-3,5,-7};
double temp5[9] = {1,3,-5,0,1,-1,-2,-2,9};
double temp6[16] = {2,1,0,0,3,0,2,2,1,3,-3,3,5,1,2,1};
double temp7[20] = {8,7,1,-78,5,-9,7,24,18,5,10,20,-2,0,11,-68,1.5,7,47,0};
CompareA1T = temp4;
CompareA2T = temp5;
CompareA3T = temp6;
CompareA4T = temp7;
int badCount = 0;
//testFramework.assert(AT == CompareAT, testMesg, __LINE__);
for(int i = 0; i < A1T.rows(); i++)
for(int j = 0; j < A1T.cols(); j++)
if (A1T(i,j) != CompareA1T(i,j)) {badCount++;}
failDescriptionStream << "Check if gpstk::transpose(A1) returns the right matrix. " << badCount << " of the elements are incorrect.";
failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str("");
testFramework.assert(badCount==0, failDescriptionString, __LINE__);
badCount = 0; // Reset error counter
for(int i = 0; i < A2T.rows(); i++)
for(int j = 0; j < A2T.cols(); j++)
if (A2T(i,j) != CompareA2T(i,j)) {badCount++;}
failDescriptionStream << "Check if gpstk::transpose(A2) returns the right matrix. " << badCount << " of the elements are incorrect.";
failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str("");
testFramework.assert(badCount==0, failDescriptionString, __LINE__);
badCount = 0; // Reset error counter
for(int i = 0; i < A3T.rows(); i++)
for(int j = 0; j < A3T.cols(); j++)
if (A3T(i,j) != CompareA3T(i,j)) {badCount++;}
failDescriptionStream << "Check if gpstk::transpose(A3) returns the right matrix. " << badCount << " of the elements are incorrect.";
failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str("");
testFramework.assert(badCount==0, failDescriptionString, __LINE__);
badCount = 0; // Reset error counter
for(int i = 0; i < A4T.rows(); i++)
for(int j = 0; j < A4T.cols(); j++)
if (A4T(i,j) != CompareA4T(i,j)) {badCount++;}
failDescriptionStream << "Check if gpstk::transpose(A4) returns the right matrix. " << badCount << " of the elements are incorrect.";
failDescriptionString = failDescriptionStream.str(); failDescriptionStream.str("");
testFramework.assert(badCount==0, failDescriptionString, __LINE__);
badCount = 0; // Reset error counter
return testFramework.countFails();
}
示例7: ipMSymbol
/////////////////////////////////////////////////////////////////////////////
// IPropertyPage
STDMETHODIMP CLogoMarkerPropertyPage::Show(UINT nCmdShow)
{
USES_CONVERSION;
// If we are showing the property page propulate it
// from the Marker symbol object.
if ((nCmdShow & (SW_SHOW|SW_SHOWDEFAULT)))
{
//colors
IColorPtr ipColor;
m_ipLogoMarker->get_ColorTop(&ipColor);
ipColor->get_RGB(&m_colTop);
::SendMessage(m_hRchTop, EM_SETBKGNDCOLOR, 0,
(LPARAM) m_colTop);
m_ipLogoMarker->get_ColorRight(&ipColor);
ipColor->get_RGB(&m_colRight);
::SendMessage(m_hRchRight, EM_SETBKGNDCOLOR, 0,
(LPARAM) m_colRight);
m_ipLogoMarker->get_ColorLeft(&ipColor);
ipColor->get_RGB(&m_colLeft);
::SendMessage(m_hRchLeft, EM_SETBKGNDCOLOR, 0,
(LPARAM) m_colLeft);
m_ipLogoMarker->get_ColorBorder(&ipColor);
ipColor->get_RGB(&m_colBorder);
::SendMessage(m_hRchBorder, EM_SETBKGNDCOLOR, 0,
(LPARAM) m_colBorder);
//angle, size and offsets
char sText[10];
double dText;
IMarkerSymbolPtr ipMSymbol(m_ipLogoMarker);
ipMSymbol->get_Size(&dText);
sprintf_s( sText, sizeof(sText), "%.2f\0", dText);
::SendMessage(m_hSpnSize, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0));
::SetWindowText(m_hEdtSize, A2T(sText));
ipMSymbol->get_Angle(&dText);
sprintf_s( sText, sizeof(sText), "%d\0", (int)dText);
::SendMessage(m_hSpnAngle, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0));
::SetWindowText(m_hEdtAngle, A2T(sText));
ipMSymbol->get_XOffset(&dText);
sprintf_s( sText, sizeof(sText), "%+.2f\0", dText);
::SendMessage(m_hSpnXOffset, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0));
::SetWindowText(m_hEdtXOffset, A2T(sText));
ipMSymbol->get_YOffset(&dText);
sprintf_s( sText, sizeof(sText), "%+.2f\0", dText);
::SendMessage(m_hSpnYOffset, UDM_SETPOS, 0, MAKELPARAM((int)(dText), 0));
::SetWindowText(m_hEdtYOffset, A2T(sText));
m_bShown = true;
}
// Let the IPropertyPageImpl deal with displaying the page
return IPropertyPageImpl<CLogoMarkerPropertyPage>::Show(nCmdShow);
}
示例8: PostOnHeader
void PostOnHeader(CONNID dwConnID, LPCSTR lpszHeaderName, LPCSTR lpszHeaderValue, LPCTSTR lpszName)
{
USES_CONVERSION;
int content_len = (int)(strlen(lpszHeaderName) + strlen(lpszHeaderValue) + 10);
LPTSTR lpszContent = new TCHAR[content_len];
wsprintf(lpszContent, _T("%s: %s"), A2T(lpszHeaderName), A2T(lpszHeaderValue));
info_msg* msg = info_msg::Construct(dwConnID, EVT_ON_HEADER, content_len, lpszContent, lpszName);
PostInfoMsg(msg);
}
示例9: PostOnRequestLine
void PostOnRequestLine(CONNID dwConnID, LPCSTR lpszMethod, USHORT usUrlFieldSet, LPCSTR lpszUrl, LPCTSTR lpszName)
{
USES_CONVERSION;
int content_len = (int)(strlen(lpszMethod) + strlen(lpszUrl) + 20);
LPTSTR lpszContent = new TCHAR[content_len];
wsprintf(lpszContent, _T("[%s/0x%02X] : %s"), A2T(lpszMethod), usUrlFieldSet, A2T(lpszUrl));
info_msg* msg = info_msg::Construct(dwConnID, EVT_ON_REQUEST_LINE, content_len, lpszContent, lpszName);
PostInfoMsg(msg);
}
示例10: _T
bool CZipObj::ZipFile(CString strSrcPath, CString strDstPath, CString strExtName /*= _T(".zip")*/)
{
USES_CONVERSION;
// CString modelName = strSrcPath.Right(strSrcPath.GetLength() - strSrcPath.ReverseFind('\\') - 1);
CString zipName = strDstPath + strExtName;
std::string strUtf8ZipName = CMyCodeConvert::Gb2312ToUtf8(T2A(zipName));
try
{
Poco::File p(strUtf8ZipName); //T2A(zipName)
if (p.exists())
p.remove(true);
}
catch (Poco::Exception)
{
}
// std::string strModelPath = T2A(strSrcPath);
std::string strUtf8ModelPath = CMyCodeConvert::Gb2312ToUtf8(T2A(strSrcPath));
try
{
Poco::File p2(strUtf8ModelPath); //T2A(zipName)
if (!p2.exists())
{
std::string strErr = Poco::format("需要壓縮的原文件夾(%s)不存在。", T2A(strSrcPath));
RecordLog(strErr);
return false;
}
}
catch (Poco::Exception)
{
}
HZIP hz = CreateZip(zipName, _strPwd.c_str());
Poco::DirectoryIterator it(strUtf8ModelPath); //strModelPath
Poco::DirectoryIterator end;
while (it != end)
{
Poco::Path p(it->path());
// std::string strZipFileName = p.getFileName();
std::string strPath = CMyCodeConvert::Utf8ToGb2312(p.toString());
std::string strZipFileName = CMyCodeConvert::Utf8ToGb2312(p.getFileName());
CString strZipPath = A2T(strPath.c_str());
CString strName = A2T(strZipFileName.c_str());
// ZipAdd(hz, A2T(strZipFileName.c_str()), A2T(p.toString().c_str()));
ZipAdd(hz, strName, strZipPath);
it++;
}
CloseZip(hz);
return true;
}
示例11: main
void main()
{
USES_CONVERSION;
if (__argc != 2)
{
printf("Usage: CPing HostName | IPAddress\n");
return;
}
#ifdef CPING_USE_ICMP
{
CPing p1;
CPingReply pr1;
if (p1.Ping1(A2T(__argv[1]), pr1))
{
hostent* phostent = gethostbyaddr((char *)&pr1.Address.S_un.S_addr, 4, PF_INET);
printf("%d.%d.%d.%d [%s], replied in RTT:%dms\n",
pr1.Address.S_un.S_un_b.s_b1, pr1.Address.S_un.S_un_b.s_b2, pr1.Address.S_un.S_un_b.s_b3,
pr1.Address.S_un.S_un_b.s_b4, phostent->h_name, pr1.RTT);
}
else
printf("Failed in call to ping, GetLastError returns: %d", GetLastError());
}
#endif
#ifdef CPING_USE_WINSOCK2
{
for(int i=0;i<4;i++)
{
CPing p2;
CPingReply pr2;
if (p2.Ping2(A2T(__argv[1]), pr2))
{
hostent* phostent = gethostbyaddr((char *)&pr2.Address.S_un.S_addr, 4, PF_INET);
if(phostent == NULL)
printf("%d.%d.%d.%d, replied in RTT:%dms\n",
pr2.Address.S_un.S_un_b.s_b1, pr2.Address.S_un.S_un_b.s_b2, pr2.Address.S_un.S_un_b.s_b3,
pr2.Address.S_un.S_un_b.s_b4, pr2.RTT);
else
printf("%d.%d.%d.%d [%s], replied in RTT:%dms\n",
pr2.Address.S_un.S_un_b.s_b1, pr2.Address.S_un.S_un_b.s_b2, pr2.Address.S_un.S_un_b.s_b3,
pr2.Address.S_un.S_un_b.s_b4, phostent->h_name, pr2.RTT);
}
else
printf("Failed in call to ping, GetLastError returns: %d", GetLastError());
}
}
#endif
}
示例12: A2T
void CIPFindDlg::GetCurSelIPMask(char *ip, char *mask)
{
USES_CONVERSION;
CString strMsg = MSG_CUR_ADAPTER;
strMsg += "IP:";
strMsg += A2T(ip);
strMsg += " Mask:";
strMsg += A2T(mask);
SetDlgItemText(IDC_STATIC_ADAPTER_MSG, strMsg);
m_strFindIP = ip;
m_strFindMask = mask;
}
示例13: CheckDlgButton
void CPPgProxy::LoadSettings()
{
USES_CONVERSION;
CheckDlgButton(IDC_ASCWOP,(thePrefs.IsProxyASCWOP() ));
((CButton*)GetDlgItem(IDC_ENABLEPROXY))->SetCheck(proxy.UseProxy);
((CButton*)GetDlgItem(IDC_ENABLEAUTH))->SetCheck(proxy.EnablePassword);
((CComboBox*)GetDlgItem(IDC_PROXYTYPE))->SetCurSel(proxy.type);
GetDlgItem(IDC_PROXYNAME)->SetWindowText(proxy.name);
CString buffer;
buffer.Format(_T("%ld"),proxy.port);
GetDlgItem(IDC_PROXYPORT)->SetWindowText(buffer);
GetDlgItem(IDC_USERNAME_A)->SetWindowText(A2T(proxy.user));
GetDlgItem(IDC_PASSWORD)->SetWindowText(A2T(proxy.password));
OnBnClickedEnableproxy();
}
示例14: _access
int _access(const char *sName, int mode)
{
USES_CONVERSION;
WIN32_FIND_DATA FindFileData;
PString test(sName);
if (test[test.GetLength() - 1] == '.' && test[test.GetLength() - 2] == PDIR_SEPARATOR)
test.Delete(test.GetLength() - 2, 2);
HANDLE file = FindFirstFile(A2T((const char*) test), &FindFileData);
if (file == INVALID_HANDLE_VALUE ) return -1;
FindClose(file);
switch(mode)
{
//checking for the existance
case 0: return 0;
//checking for read permission
case 4: return 0;
//checking for write permission
case 2: return (FindFileData.dwFileAttributes&FILE_ATTRIBUTE_READONLY) ? -1 : 0;
//checking for read and write permission
case 6: return (FindFileData.dwFileAttributes&FILE_ATTRIBUTE_READONLY) ? -1 : 0;
}
return -1;
}
示例15: wince_mess_vprintf
static int wince_mess_vprintf(char *fmt, va_list arg)
{
int length;
int old_length;
LPTSTR new_messages;
LPCTSTR tbuffer;
char buffer[256];
/* get into a buffer */
length = vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), fmt, arg);
tbuffer = A2T(buffer);
/* output to debugger */
OutputDebugString(tbuffer);
/* append the buffer to the rest of the messages */
old_length = messages ? tcslen(messages) : 0;
new_messages = realloc(messages, (old_length + tcslen(tbuffer) + 1) * sizeof(TCHAR));
if (new_messages)
{
messages = new_messages;
tcscpy(messages + old_length, tbuffer);
}
return length;
}