Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Silly newbie question - Caret character (^)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peter Nilsson  
View profile  
 More options Nov 11 2010, 4:26 pm
Newsgroups: comp.lang.c
From: Peter Nilsson <ai...@acay.com.au>
Date: Thu, 11 Nov 2010 13:26:18 -0800 (PST)
Local: Thurs, Nov 11 2010 4:26 pm
Subject: Re: Silly newbie question - Caret character (^)

> Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> wrote:
> > Another function that should be deprecated is strncat???
> > I myself was caught out misunderstanding it recently.
> > What purpose does it serve?

Like strtok, it serves a niche purpose that doesn't come up as
often as people might think.

Seebs <usenet-nos...@seebs.net> wrote:
> I'm wondering if you're thinking of strncpy(),
> which is the famously bogus one.

Yet it's actually strncat that is the odd one out of the trio...

  strncat(p, q, n) -  p is string, q is array
  strncmp(p, q, n) -  p is array,  q is array
  strncpy(p, q, n) -  p is array,  q is array

If they were prefixed memn, instead of strn, then I'm reasonably
sure there would be fewer complaints and surprises with strncpy.

The problem with strncpy is not that it pads with zero or won't
terminate a full array. The problem is that it doesn't let you
choose the pad character.

--
Peter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.