osg中設置線的間斷類型。string轉16進制::strtoll

先轉成0X的字符串

std::string string_to_hex(const std::string& str) //transfer string to hex-string
{
	std::string result = "0X";
	std::string tmp;
	stringstream ss;
	for (int i = 0; i < str.size(); i++)
	{
		ss << hex << int(str[i]) << endl;
		ss >> tmp;
		result += tmp;
	}
	return result;
}

再將0XFFFF等轉成longlong類型即可

	long long result = strtoll(type.at(1).c_str(), NULL, 16);

 

 

 

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