From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21275 invoked by alias); 17 Mar 2003 16:27:13 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 21232 invoked from network); 17 Mar 2003 16:27:13 -0000 Received: from unknown (HELO junior.lgc.com) (134.132.72.99) by sources.redhat.com with SMTP; 17 Mar 2003 16:27:13 -0000 Received: from lgchvw01.lgc.com (lgchvw01.lgc.com [134.132.93.107]) by junior.lgc.com (8.11.6/8.11.3) with SMTP id h2HGQ6j05672 for ; Mon, 17 Mar 2003 10:26:06 -0600 (CST) Received: from 134.132.93.152 by lgchvw01.lgc.com (InterScan E-Mail VirusWall NT); Mon, 17 Mar 2003 10:27:01 -0600 Received: by lgchexchbh.ad.lgc.com with Internet Mail Service (5.5.2653.19) id <1C7PQLXZ>; Mon, 17 Mar 2003 10:27:11 -0600 Message-ID: <57A168CAC1B2A6409978DF309F6FDB39C4EB12@lgchexch008.ad.lgc.com> From: Jane Liang To: "'GCC-help'" Subject: Help wanted Date: Mon, 17 Mar 2003 16:44:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------InterScan_NT_MIME_Boundary" X-SW-Source: 2003-03/txt/msg00195.txt.bz2 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --------------InterScan_NT_MIME_Boundary Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C2ECA2.086C0830" ------_=_NextPart_001_01C2ECA2.086C0830 Content-Type: text/plain Content-length: 677 Hi, all: I have a simple program(see below), it ran without any problem in sun (with sun's compiler). However, when I compiled it in gcc on PC, it crashed at line 13. I tried to use strtok and some other string functions but none of them seems works fine. Does anyone know why? Thanks! Jane Line 1 #include Line 2 #include Line 3 #include Line 4 Line 5 int main() Line 6 { Line 7 Line 8 char *str = "0.12000, 0.0, 0.0"; Line 9 char *ptr; Line 10 float num; Line 11 Line 12 ptr = strchr(str, ','); Line 13 *ptr = '\0'; Line 14 Line 15 num = atof(str); Line 16 Line 17 return 0; Line 18 } ------_=_NextPart_001_01C2ECA2.086C0830 Content-Type: text/html Content-Transfer-Encoding: quoted-printable Content-length: 2308 Help wanted

Hi, all:

I have a simple program(see below), it ran= without any problem in sun (with sun's compiler). However, when I compiled= it in gcc on PC, it crashed at line 13.  I tried to use strtok and so= me other string functions but none of them seems works fine.  Does any= one know why?

Thanks!

Jane


Line 1    #include &l= t;stdlib.h>
Line 2    #include &= lt;stdio.h>
Line 3    #include &= lt;string.h>
Line 4
Line 5    int main()=
Line 6    {
Line 7
Line 8     = ; char *str =3D "0.12000, 0.0, 0.0";
Line 9     = ; char *ptr;
Line 10     flo= at  num;
Line 11
Line 12     ptr= =3D strchr(str, ',');
Line 13     *pt= r =3D '\0';
Line 14
Line 15     num= =3D atof(str);
Line 16
Line 17     ret= urn 0;
Line 18   }


= ------_=_NextPart_001_01C2ECA2.086C0830-- --------------InterScan_NT_MIME_Boundary--