將字符串的前八個字節轉換爲__int64位整數

__int64 CCtpKernel::ColumnStringToInt64(std::string& strName)
{
	__int64 nRet = 0;
	const char* p = strName.c_str();
	char* s = (char*)&nRet;

	for (int i = 0; i < 8 && *p != '\0'; i++)
	{
		*s = *p;

		p++;
		s++;
	}

	return nRet;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章