Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #28436

Re: snprintf return value

Path csiph.com!weretis.net!feeder7.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.70.MISMATCH!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!post01.iad!fx03.iad.POSTED!not-for-mail
Subject Re: snprintf return value
Newsgroups comp.arch.embedded
References <pulekl$n55$1@dont-email.me> <g78c9gFctonU1@mid.dfncis.de>
From Clifford Heath <no.spam@please.net>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1
MIME-Version 1.0
In-Reply-To <g78c9gFctonU1@mid.dfncis.de>
Content-Type text/plain; charset=iso-8859-15; format=flowed
Content-Language en-US
Content-Transfer-Encoding 8bit
Lines 19
Message-ID <QjFPD.494212$9O2.164489@fx03.iad> (permalink)
X-Complaints-To DMCA@thecubenet.com
NNTP-Posting-Date Tue, 11 Dec 2018 02:31:12 UTC
Date Tue, 11 Dec 2018 13:31:11 +1100
X-Received-Bytes 1250
X-Received-Body-CRC 3868857508
Xref csiph.com comp.arch.embedded:28436

Show key headers only | View raw


On 11/12/18 10:47 am, Hans-Bernhard Bröker wrote:
> Or much simpler as
> 
>     snprintf(buf, BUFLEN,
>        ...
>        ...
>        ...
>        ...
>     );

One would assume there's some logic between appending bits of string.

>     buf[BUFLEN - 1] = '\0';  // just in case we hit bottom

Now who needs to read the documentation? snprintf guarantees always to 
null-terminate.

Clifford Heath.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

snprintf return value pozz <pozzugno@gmail.com> - 2018-12-10 11:20 +0100
  Re: snprintf return value Reinhardt Behm <rbehm@hushmail.com> - 2018-12-10 18:24 +0800
    Re: snprintf return value pozz <pozzugno@gmail.com> - 2018-12-10 11:32 +0100
      Re: snprintf return value Philipp Klaus Krause <pkk@spth.de> - 2019-01-01 12:59 +0100
  Re: snprintf return value David Brown <david.brown@hesbynett.no> - 2018-12-10 13:15 +0100
  Re: snprintf return value Clifford Heath <no.spam@please.net> - 2018-12-11 08:49 +1100
    Re: snprintf return value Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2018-12-11 11:41 -0500
      Re: snprintf return value Clifford Heath <no.spam@please.net> - 2018-12-12 10:34 +1100
        Re: snprintf return value David Brown <david.brown@hesbynett.no> - 2018-12-12 09:09 +0100
          Re: snprintf return value Clifford Heath <no.spam@please.net> - 2018-12-12 21:38 +1100
        Re: snprintf return value Les Cargill <lcargill99@comcast.com> - 2018-12-30 11:23 -0600
  Re: snprintf return value Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2018-12-11 00:47 +0100
    Re: snprintf return value Clifford Heath <no.spam@please.net> - 2018-12-11 13:31 +1100

csiph-web