Problem with string conversion

Hi, I have this code that wil hash the return value of harddrive serial number but I'm having some problem.

1
2
3
4
5
6
7
8
9
DWORD serialNumber = { 0 };
std::string buffer;

GetVolumeInformation(("C:\\"), NULL, NULL, &serialNumber, NULL, NULL, NULL, NULL);
std::hash<_STD string> hs;
buffer = hs(std::to_string((_ULONGLONG)serialNumber));

std::cout << buffer << std::endl;
std::cout << hs(std::to_string((_ULONGLONG)serialNumber)) << std::endl;


As you can see I have 2 cout, the first one was printing a sysmbol like a small T and the second one was working fine. But the one I need is the first one but I don't know what is wrong.
hash function returns value of std::size_t, not string. You can assign number to string bur you will gen unexpected results.
how can I convert it to string?
std::to_string is created to convert values to string
Last edited on
Topic archived. No new replies allowed.