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


Groups > comp.lang.c > #54988

Re: fseek under IBM MVS

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: fseek under IBM MVS
Date 2014-12-18 11:03 -0800
Organization None to speak of
Message-ID <lnbnn0dbm9.fsf@nuthaus.mib.org> (permalink)
References (6 earlier) <f04dfd77-aa90-4604-bd6b-c81fc3861e05@googlegroups.com> <549212fb.25673218@news.xs4all.nl> <ln1tnxes0a.fsf@nuthaus.mib.org> <5492c2fc.401187@news.xs4all.nl> <54930469.3010102@verizon.net>

Show all headers | View raw


James Kuyper <jameskuyper@verizon.net> writes:
> On 12/18/2014 07:06 AM, Richard Bos wrote:
>> Keith Thompson <kst-u@mib.org> wrote:
>>> raltbos@xs4all.nl (Richard Bos) writes:
>>> [...]
>>>> My problem is simply with depending on the wrong method when there is a
>>>> better one already available. It's similar to why I don't understand why
>>>> anyone would use strcpy() when they can do the same thing better, more
>>>> efficiently, and usually more reliably, with strcat(): even if the
>>>> difference is marginal, the cost is zero.
>>>
>>> How is strcat() an improvement over strcpy()? 
>> 
>> Sorry, typo/braino. I meant strncpy() and strncat().
>
> That makes more sense, though my own preferences differ. In most
> contexts in my code where I might need either one or the other of those,
> I already know the starting place for inserting new characters, and I
> need the unused portion of the array to be nulled out.  Every appearance
> of strncat() in code that I am currently responsible for was due to it
> being originally written by someone else.

Then you must be one of the few people who use strncpy() correctly.
Most uses of it that I've seen are by people who incorrectly assume that
it's a safer version of strcpy() in the same way that strncat() is a
safer version of strcat().

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-14 22:16 +0100
  Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-15 01:12 +0000
    Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-15 09:13 +0100
      Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-15 09:22 +0000
  Re: fseek under IBM MVS Kaz Kylheku <kaz@kylheku.com> - 2014-12-15 16:26 +0000
    Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 09:58 +0000
      Re: fseek under IBM MVS BartC <bc@freeuk.com> - 2014-12-17 11:29 +0000
  Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-15 10:35 -0800
    Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-15 21:33 +0000
      Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-15 23:45 +0100
        Re: fseek under IBM MVS Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-12-15 17:56 -0500
          Re: fseek under IBM MVS Kaz Kylheku <kaz@kylheku.com> - 2014-12-15 23:05 +0000
          Re: fseek under IBM MVS BartC <bc@freeuk.com> - 2014-12-15 23:19 +0000
            Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-15 16:36 -0800
            Re: fseek under IBM MVS Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-12-15 20:42 -0500
          Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-16 01:00 +0100
        Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-16 01:09 +0000
          Re: (OT) fseek under IBM MVS Vincenzo Mercuri <nomail@yahoo.it> - 2014-12-16 09:11 +0100
        Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 10:06 +0000
          Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-17 11:33 +0100
            Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 08:48 -0800
              Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 17:26 +0000
              Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-17 19:46 +0100
                Re: fseek under IBM MVS Richard Heathfield <invalid@see.sig.invalid> - 2014-12-17 19:28 +0000
                Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-17 21:38 +0100
                Re: fseek under IBM MVS Richard Heathfield <invalid@see.sig.invalid> - 2014-12-17 21:05 +0000
                Re: fseek under IBM MVS Ian Collins <ian-news@hotmail.com> - 2014-12-18 11:37 +1300
                Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 12:43 -0800
        Re: fseek under IBM MVS fir <profesor.fir@gmail.com> - 2014-12-19 08:35 -0800
          Re: fseek under IBM MVS BartC <bc@freeuk.com> - 2014-12-19 16:51 +0000
          Re: fseek under IBM MVS Robert Wessel <robertwessel2@yahoo.com> - 2014-12-19 16:36 -0600
    Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 10:05 +0000
      Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 09:05 -0800
        Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 17:29 +0000
          Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 12:55 -0800
            Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 15:02 -0800
              Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 23:37 +0000
                Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 16:11 -0800
                Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-18 12:06 +0000
                Re: fseek under IBM MVS James Kuyper <jameskuyper@verizon.net> - 2014-12-18 11:44 -0500
                Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-18 11:03 -0800
                Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-19 11:31 +0000
                Re: fseek under IBM MVS James Kuyper <jameskuyper@verizon.net> - 2014-12-19 08:03 -0500
                Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-19 08:08 -0800
                Re: fseek under IBM MVS James Kuyper <jameskuyper@verizon.net> - 2014-12-19 11:30 -0500
              Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 15:56 -0800
              Re: fseek under IBM MVS Ian Collins <ian-news@hotmail.com> - 2014-12-21 21:37 +1300
        Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-17 21:59 +0000
          Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 14:33 -0800
          Re: fseek under IBM MVS "Charles Richmond" <numerist@aquaporin4.com> - 2014-12-18 16:06 -0600
  Re: fseek under IBM MVS Siri Crews <chine.bleu@yahoo.com> - 2014-12-17 04:20 -0800

csiph-web