Convert string to GUID with sscanf
- by Andy Li
I'm trying to convert a string to GUID with sscanf:
GUID guid;
sscanf( "11111111-2222-3333-4455-667788995511", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&guid.Data1, &guid.Data2, &guid.Data3,
&guid.Data4[0], &guid.Data4[1], &guid.Data4[2],
&guid.Data4[3], &guid.Data4[4], &guid.Data4[5],
&guid.Data4[6], &guid.Data4[7]);
However, in runtime, it fails and exits with "Error: Command failed". Why? How to fix it?
I do not want to compile with /clr so cannot use System.