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


Groups > comp.lang.c > #4045

Re: I need help

From Phil Carmody <thefatphil_demunged@yahoo.co.uk>
Newsgroups comp.lang.c
Subject Re: I need help
Date 2011-05-16 04:34 +0300
Organization A noiseless patient Spider
Message-ID <8762pbv36u.fsf@bazspaz.fatphil.org> (permalink)
References <45f62c12-a439-42b7-be27-bab7c954e209@glegroupsg2000goo.googlegroups.com> <iqmhmk$5mt$1@news.m-online.net> <iqog3e$27h$1@dont-email.me> <iqoh10$ahj$1@news.m-online.net> <iqohu1$aa1$1@dont-email.me>

Show all headers | View raw


Eric Sosman <esosman@ieee-dot-org.invalid> writes:

> On 5/15/2011 8:30 AM, Heinrich Wolf wrote:
> >
> > "Eric Sosman" <esosman@ieee-dot-org.invalid> schrieb im Newsbeitrag
> > news:iqog3e$27h$1@dont-email.me...
> > ...
> >> However, you ought to mention that this STRNCAT macro relies
> >> on the pre-existing '\0' at the end of the output array. If
> >> string[9] were '?' instead of '\0', STRNCAT would run happily but
> >> leave you with a non-terminated string, just waiting to cause
> >> unpleasant surprises later.
> > ...
> > No! strncat guarantees to append a terminating '\0' character, even if
> > it needs to truncate the source string. That is the difference to
> > strncpy. You do net need to memset(output, 0 sizeof(output)); The only
> > prerequisite is, that output is terminated by a single '\0' before. But
> > that is the same with strcat.
> 
>      My apologies: I confused `strncat' with `strncpy'.

Votes for abolishing srtncat?

1 here; I trust the above is enough of a reason to come on board, and from 
what Heinrich has posted, hopefully there's a 3rd vote too.

Phil
-- 
"At least you know where you are with Microsoft."
"True. I just wish I'd brought a paddle." -- Matthew Vernon

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: I need help janus <emekamicro@gmail.com> - 2011-05-14 11:15 -0700
  Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-14 20:29 +0200
    Re: I need help Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-15 13:03 +0300
      Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-15 13:18 +0200
        Re: I need help Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-16 04:31 +0300
    Re: I need help Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-15 08:13 -0400
      Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-15 14:30 +0200
        Re: I need help Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-15 08:45 -0400
          Re: I need help Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-16 04:34 +0300
    Re: I need help Ian Collins <ian-news@hotmail.com> - 2011-05-16 13:42 +1200
      Re: I need help Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-16 03:28 +0100
      Re: I need help pete <pfiland@mindspring.com> - 2011-05-15 22:45 -0400
        Re: I need help Ian Collins <ian-news@hotmail.com> - 2011-05-16 14:50 +1200
      Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-16 12:26 +0200
  Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-14 11:33 -0700
  Re: I need help Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-15 07:58 -0400

csiph-web