delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/03/05/15:16:19

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Roberto Quiroga <noswen AT example DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: snprintf error
Date: Fri, 05 Mar 2004 17:02:47 -0300
Lines: 39
Message-ID: <87hdx3t63c.fsf@cube.internal.net>
References: <c29lrm$1qn5kr$1 AT ID-203837 DOT news DOT uni-berlin DOT de>
NNTP-Posting-Host: 200-41-33-131-tntteco1.dial-up.net.ar (200.41.33.131)
Mime-Version: 1.0
X-Trace: news.uni-berlin.de 1078517120 62446990 I 200.41.33.131 ([192799])
X-Orig-Path: cube.internal.net!news
User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.2 (berkeley-unix)
Cancel-Lock: sha1:SA0H+42dpPZHGiectWkI7tWiuBE=
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Vijay Kumar R Zanvar" <vijoeyz AT hotpop DOT com> escribió:


> F:\Vijay\C> gcc -std=c99 -Wall string.c: In function `main':
> string.c:27: warning: implicit declaration of function `snprintf'
> f:/vijay/djgpp/tmp/cceCfRI9.o(.text+0xcd):string.c: undefined
> reference to `_snprintf'

From google:

On Wed, 10 Jul 2002 00:25:55 CDT
Charles Sandmann <sandmann AT clio DOT rice DOT edu> writes:

>The program you are trying to build is using the routine snprintf(),
>which is a relatively new call and not available in the v2.03
>library.

>You can either try the 2.04 work in progress library, or inspect the
>code and see if you can get by with a simple define:

>#define snprintf(a,b,c,d) sprintf(a,c,d)

>This define assumes the string is long enough.  snprintf() is a safe
>sprintf call which you send the string length so you don't get buffer
>overruns.

An alternative that works in your sample program:

http://www.ijs.si/software/snprintf/snprintf_2.2.tar.gz

in string.c #include "snprintf.h"

gcc -std=c99 -Wall -o string.exe snprintf.c string.c


Hope this helps.

-- 
Roberto Quiroga

- Raw text -


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