I actually think I can use the boost uuid generator. It worked in my testing :O) Sorry for the inconvenience CONFIDENTIAL INFORMATION NOTICE: The information contained in this e-mail is privileged, confidential and intended solely for the use of the addressee named above. If the reader of this e-mail is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail is strictly prohibited. If you received this in error, please contact the sender and destroy all copies of this e-mail. Thank you. From: Carla Strembicke Sent: May-05-10 4:31 PM To: boost-users@lists.boost.org Subject: dnd boost uuids I am trying to convert a legacy GUID on mircosoft to use the boost uuid. I am utilizing the stringstream as mentioned in the boost uuid documentation. I have managed to get the GUID converted into a string but am unable to inject the string value Into the uuid variable. Below is just a snippet of a test program. I read it back into a buffer variable to make sure that value was properly set. ss gets the value of guid_str but does not set the value in uuid_test. WCHAR guid_buf[50]; Boost::uuids::uuid uuid_test; StringFromGUID2(guid_value, guid_buf, 50); char *guid_str = OLE2A(guid_buf); std::stringstream ss; char buf[50]; ss << guid_str; ss >> uuid_test; ss << uuid_test; ss >> buf; Obvioulsy I am using stringstream wrong. Does anyone know how to convert a GUID to a boost UUID? I can't seem to find the documentation or interface.
Hi Carla,
StringFromGUID2 outputs the string form of the guid with braces,
ie:
{c200e360-38c5–11ce-ae62-08002b2b79ef}
But, operator>>(istream&, uuid&) does not expect the braces. It expects
the uuid string in the form: c200e360-38c5–11ce-ae62-08002b2b79ef As you
discovered, string_generator accepts both forms and from wide or narrow
strings. The following should work:
WCHAR guid_buf[50];
StringFromGUID2(guid_value, guid_buf, 50);
boost::uuids::uuid uuid_test =
boost::uuids::string_generator()(guid_buf);
Regards,
Andy.
On Wed, 05 May 2010 16:50 -0600, "Carla Strembicke"
participants (2)
-
Andy Tompkins
-
Carla Strembicke