sprintf_s was not declared in this scope

SPB picture SPB · Jan 28, 2011 · Viewed 42.7k times · Source

I have a C program that uses sprintf_s. It works fine in Windows, but when I compile my code in Linux it gives this error:

sprintf_s was not declared in this scope.

Why does this happen and how can I fix it?

Answer

peoro picture peoro · Jan 28, 2011

It's not standard, you won't find such function on Linux.

Standard function snprintf should have a similar semantics.