www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/05/09:56:04

Message-ID: <38733A75.4D841D0B@pallen.dabsol.co.uk>
Date: Wed, 05 Jan 2000 12:35:01 +0000
From: Peter Allen <P DOT Allen AT pallen DOT dabsol DOT co DOT uk>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Any snprintf in djgpp?
Reply-To: djgpp AT delorie DOT com


-------- 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019