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


Groups > comp.lang.c > #59185

Re: what the fork is wrong with strtok_r

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: what the fork is wrong with strtok_r
Date 2015-03-28 21:33 -0400
Organization A noiseless patient Spider
Message-ID <mf7ko9$a8$1@dont-email.me> (permalink)
References <mf6eja$cls$1@reader1.panix.com> <mf6ffi$jqa$1@dont-email.me> <87384omybp.fsf@kst-u.example.com>

Show all headers | View raw


On 03/28/2015 08:39 PM, Keith Thompson wrote:
> James Kuyper <jameskuyper@verizon.net> writes:
> [...]
>> Note: if you're using gets() to read the text string, '\n' characters
>> will be replaced with '\0', which would make tokenizing on '\n' a little
>> difficult. If that fact is completely irrelevant to your problem, that
>> demonstrates the need for item 1.
> 
> If you're using gets(), that's your first problem.  gets() is inherently
> unsafe, and has been removed from the language as of the 2011 standard.

I was going to get into that later, if he confirmed that gets() was
involved. It's just the simplest way I could think of to make the '\n'
characters he was planning to tokenize on be unintentionally absent.
It's not a particularly plausible way - which is why I didn't want to go
into it in any detail unless and until he confirmed that it was relevant.
-- 
James Kuyper

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


Thread

what the fork is wrong with strtok_r what <ceo@iran.gov> - 2015-03-28 14:41 +0000
  Re: what the fork is wrong with strtok_r James Kuyper <jameskuyper@verizon.net> - 2015-03-28 10:57 -0400
    Re: what the fork is wrong with strtok_r Keith Thompson <kst-u@mib.org> - 2015-03-28 17:39 -0700
      Re: what the fork is wrong with strtok_r James Kuyper <jameskuyper@verizon.net> - 2015-03-28 21:33 -0400
      Re: what the fork is wrong with strtok_r ruben safir <ruben@mrbrklyn.com> - 2015-03-29 03:36 -0400
      Re: what the fork is wrong with strtok_r ruben safir <ruben@mrbrklyn.com> - 2015-03-29 03:39 -0400
  Re: what the fork is wrong with strtok_r Lőrinczy Zsigmond <nospam@for.me> - 2015-03-29 08:28 +0200

csiph-web