sprintf_s(colorBuffer, 255, "%.2X", getAlpha());
result.append(colorBuffer);
The error is:
Use of undeclared identifier 'sprintf_s'
CodePudding user response:
sprintf_s
is part annex K of the C11 standard, titled "bounds-checking interfaces". Annex K is optional.
Annex K hasn't been successful. N1967 Field Experience With Annex K — Bounds Checking Interfaces stated in 1995:
Despite more than a decade since the original proposal and nearly ten years since the ratification of ISO/IEC TR 24731-1:2007, and almost five years since the introduction of the Bounds checking interfaces into the C standard, no viable conforming implementations has emerged. The APIs continue to be controversial and requests for implementation continue to be rejected by implementers.
The authors even propose:
... that Annex K be either removed from the next revision of the C standard, or deprecated and then removed.
The only major compiler to implement it (or part of it) is Visual Studio. No luck with Xcode (based on clang) or gcc.