Mail Archives: djgpp/2000/01/05/09:56:04
-------- Original Message --------
Subject: Any snprintf in djgpp?
Date: Mon, 03 Jan 2000 21:56:38 +0000
From: Peter Allen <P DOT Allen AT pallen DOT dabsol DOT co DOT uk>
To: djgpp AT delorie DOT com
Is there an implementation of snprintf or similar in djgpp?
If not I think it would be a good thing to add, as sprintf does
not guard against buffer overuns.
For those that have not come across it, snprintf, prototype
int snprintf(char *str, size_t str_m, const char *fmt,...);
does exactly the same as sprintf but stops buffer overun
by having the additional argument size_t str_m.
I guess it would not be difficult to modify the existing sprintf
code, although for reference there is a gpl'd implementation here:
http://www.ijs.si/software/snprintf/
although of course being gpl'd it could not be included in libc.
Peter Allen
- Raw text -