Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: what the fork is wrong with strtok_r Date: Sat, 28 Mar 2015 17:39:22 -0700 Organization: None to speak of Lines: 15 Message-ID: <87384omybp.fsf@kst-u.example.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="c77ff4d35e33d1c939d3461ebde8dd0d"; logging-data="32232"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VY8TDTS6E+kv1y1vjngFS" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ZW/Hw81JZK2d4uPvJFAk+18IBWg= sha1:KPehSbzbV6yyA48c+tqRrwB26sw= Xref: csiph.com comp.lang.c:59184 James Kuyper 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. -- Keith Thompson (The_Other_Keith) kst-u@mib.org 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"