On Tue, 2007-11-27 at 05:50 -0500, Enlightenment CVS wrote: > Modified Files: > edje_cc_sources.c > > > Log Message: > > > terminate strings properly?
You mean over-terminate strings properly. snprintf will always terminate strings correctly. It writes no more then N characters "including the terminating null byte". (That last bit from the C standard). This means the following code is silly (double terminates): char buf[BUFSIZ]; snprintf(buf, BUFSIZ - 1, ...); as is snprintf(buf, BUFSIZ, ...); buf[BUFSIZ - 1] = 0; The first makes your buffer too small, the second sets a nil over a guaranteed nil. Of course they are broken implementations... but that's another story. char buf[10]; snprintf(buf,10,"Long String Longer then 10 bytes"); puts(buf); Should print: "Long Stri" As an aside: > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ Do these marketing people even know what sourceforge is? Regards, nash ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel