You also can't use sprintf_s here, since it only works with MSVC.  Use `snprintf`, which has defines for MSVC.
The usage of `snprintf` is fine, even in MSVC, since we can make sure that the buffer is long enough.