I have a GUID variable and I want to write inside a text file its value. GUID definition is:
typedef struct _GUID { // size is 16
DWORD Data1;
Use the StringFromCLSID function to convert it to a string
e.g.:
GUID guid;
CoCreateGuid(&guid);
OLECHAR* guidString;
StringFromCLSID(guid, &guidString);
// use guidString...
// ensure memory is freed
::CoTaskMemFree(guidString);
Also see the MSDN definition of a GUID for a description of data4, which is an array containing the last 8 bytes of the GUID