Hack #1
Hack #2

(only Windows 7 or later have SetThreadErrorMode)
Hack #3

swscanf_s is MSVC-only.
Hack #4

Not valid C++, just happens to be supported by MSVC.

FIXME: this is not a proper solution by nay means.