[PD-dev] snprintf vs. sprintf_s?

Martin Peach martin.peach at sympatico.ca
Wed Jan 16 17:04:32 CET 2008


Miller Puckette wrote:
>Hi Devs,
>
>I found out that .Net apparently doesn't use "snprintf" but has a similar
>function named "sprintf_s".  (A couple of recent patches change "sprintfs"
>to "snprintfs" leading to compile errors in .Net).  I'm thinking of just
>putting the following in s_main.c and s_file.c:
>
>#ifdef MSW
>#define snprinf sprintf_s
>#endif
>
>My question: will this break cygwin or some other non-microsoft compiler
>for Windows?
>

Probably. I did it like this in tcpclient.c, which compiles OK in 
pd-extended:
#ifdef _MSC_VER
#define snprintf sprintf_s
#endif

_MSC_VER is only defined for the microsoft compiler.

Martin






More information about the Pd-dev mailing list