Article View: gnu.gcc.bug
Article #6004Re: gcc 2.7.2 problem with strtok()
From: Alain Magloire
Date: Fri, 27 Dec 1996 00:00
Date: Fri, 27 Dec 1996 00:00
33 lines
1085 bytes
1085 bytes
M.Wang (xiaofei@lucent.com) wrote:
: what is wrong with the following program?
"a b c" is a __string constant__ i.e non-writable
strtok() will modify it hence the coredump
try
char string[10] = "a b c";
strtok(string, " ");
: #include <stdio.h>
: #include <string.h>
: int
: main()
: {
: strtok("a b c", " ");
: return 0;
: }
: It generate the following error message:
: (15:48)(/home/mwang/c)gcc 1.c
: (15:48)(/home/mwang/c)./a.out
: Memory fault(coredump)
: Thanks
--
bonne anne'e, alain
Technical Details
Message-ID:
<59vsbh$smg@sifon.cc.mcgill.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<59vbmi$9i0@nntpb.cb.lucent.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,18b9f2c0ce00f3 X-Google-Attributes: gid113d02,public From: alainm@macs.ee.mcgill.ca (Alain Magloire) Subject: Re: gcc 2.7.2 problem with strtok() Date: 1996/12/27 Message-ID: <59vsbh$smg@sifon.cc.mcgill.ca> X-Deja-AN: 206163263 sender: bug-gcc-request@prep.ai.mit.edu references: <59vbmi$9i0@nntpb.cb.lucent.com> organization: McGill University, Montreal, Canada. x-gateway: relay6.UU.NET from bug-gcc to gnu.gcc.bug; Fri, 27 Dec 1996 02:03:35 EST newsgroups: gnu.gcc.bug