From: alain AT qnx DOT com (Alain Magloire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Any snprintf in djgpp? Date: 5 Jan 2000 22:03:55 GMT Organization: QNX Software Systems Lines: 41 Message-ID: <850f4b$2k2$1@gateway.qnx.com> References: <38733A75 DOT 4D841D0B AT pallen DOT dabsol DOT co DOT uk> NNTP-Posting-Host: qnx.com X-Trace: gateway.qnx.com 947109835 2690 209.226.137.1 (5 Jan 2000 22:03:55 GMT) X-Complaints-To: usenet AT qnx DOT com NNTP-Posting-Date: 5 Jan 2000 22:03:55 GMT X-Newsreader: TIN [version 1.2 PL2] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Peter Allen (P DOT Allen AT pallen DOT dabsol DOT co DOT uk) wrote: : -------- Original Message -------- : Subject: Any snprintf in djgpp? : Date: Mon, 03 Jan 2000 21:56:38 +0000 : From: Peter Allen
: 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. Ho ! Thanks for the reminder, I wanted to that, and somehow things got shift And with memory fading .... Suprisingly snprintf(5 lines) is quite trivial to incorparte to DJGPP since all the machinery is already in place. However there were some things that did not work correctly, I would have to dig ... Hopefully this time memory will hold. If you need a LGPL version, I wrote one long long time ago ... I think it is still available at : ftp://mccoy.ee.mcgill.ca/pub/alain/misc/snprintf/snprintf-1.2.tar.gz It has been use in many commercial and non-commercial software -- au revoir, alain ---- Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!