Hex string convert to integer with stringstream
2014-10-08 23:24
567 查看
#include <sstream>
#include <iostream>
int main() {
unsigned int x;
std::stringstream ss;
ss << std::hex << "FF";
ss >> x;
// output it as a signed type
std::cout << static_cast<int>(x) << std::endl;
}
#include <iostream>
int main() {
unsigned int x;
std::stringstream ss;
ss << std::hex << "FF";
ss >> x;
// output it as a signed type
std::cout << static_cast<int>(x) << std::endl;
}
相关文章推荐
- [C++] Hex string convert to integer with stringstream
- How to convert enum to string with boost library
- Write a function to convert an IPv4 Address in string format to an unsigned integer
- Convert integer to string(int类型转化为string类型)
- Javascript hash functions to convert string into integer hash
- 【LeetCode with Python】 String to Integer (atoi)
- how convert large HEX string to binary array ?
- leetcode 8 Implement atoi to convert a string to an integer.
- 《leetCode》:Convert String to Integer
- 【leetcode with java】8 String to Integer (atoi)
- How to convert a String to Stream
- Convert String to Stream
- How do I add an integer value with javascript (jquery) to a value that's returning a string?
- safe convert string to integer function
- How Do I Convert an Integer to a String in Excel VBA
- How to convert int to string with C++ - forest的日志 - 网易博客
- Convert String to Stream
- Convert asio::streambuf to std::string
- [C Language Utility]Convert Hex String to string represented by its corresponding Hex Values
- Convert a byte[] array to readable string format. This makes the "hex" readable!