I am working on a project in which I need to use swscanf() to find out if a string value is either Decimal or Hex. After that, I am putting that value in a variable. The function is:
Input_String(const std::wstring& a, const StringFormat b)
{
unsigned int Value;
switch (b)
{
case Decimal:
swscanf(string.c_str(), L"%u", &Value);
break;
case HexCode:
swscanf(string.c_str(), L"%x", &Value);
break;
default:
swscanf(string.c_str(), L"%u", &Value);
break;
}
}
StringFormat is an enum for format checking.
I want to create an alternative for the swscanf() for the case. Is there any possible way to do this?