Article View: comp.unix.programmer
Article #3565Re: crashes on char[]
From: cal
Date: Thu, 17 Jan 2002 21:20
Date: Thu, 17 Jan 2002 21:20
47 lines
2218 bytes
2218 bytes
Hi there,
char asc[36864];
struct tm* localTime = new tm();
time(&timer);
localtime_r(&timer,localTime);
asctime_r(localTime, asc);
time_date = strdup(asc);
time_date[strlen(time_date) - 1] = '\0';
or
byte data[16384];
for(long offs = element.offset; offs < length; )
{
int cbRead = read(fileRead, data, 16384);
if(cbRead <= 0)
{
break;
}
offs = offs + cbRead;
write(fileWrite, data, cbRead);
}
It crashes whenever I use array....... It is ok on SUN but when I port to
HP, the problem comes out........
<John Gordon>; <217-352-6511x7418>; "CEERD-CF-N"
<gordon@osiris.cso.uiuc.edu> wrote in message
news:xKG18.7544$tg4.94829@vixen.cso.uiuc.edu...
> "cal" <ccheng@cybermation.com> writes:
>
> > Hi there,
> > My program crashes whenever I use char array, eg,
>
> > char data[1024];
>
> you're probably copying too many characters into the array.
>
> post your code, and we might be able to help you further.
>
> ---
> John Gordon "No Silicon Heaven? Preposterous! Where
would
> gordon@osiris.cso.uiuc.edu all the calculators go?" -- Kryten, Red
Dwarf
Technical Details
Message-ID:
<QeH18.95370$Z2.1353672@nnrp1.uunet.ca>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.uunet.ca!nnrp1.uunet.ca.POSTED!not-for-mailReferences:
<mqG18.95347$Z2.1353132@nnrp1.uunet.ca> <xKG18.7544$tg4.94829@vixen.cso.uiuc.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,577607e3d4dd254d X-Google-Attributes: gid11318c,public X-Google-Thread: fc89c,577607e3d4dd254d X-Google-Attributes: gidfc89c,public X-Google-ArrivalTime: 2002-01-17 13:20:49 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.uunet.ca!nnrp1.uunet.ca.POSTED!not-for-mail From: "cal" <ccheng@cybermation.com> Newsgroups: comp.unix.programmer,gnu.gcc.help References: <mqG18.95347$Z2.1353132@nnrp1.uunet.ca> <xKG18.7544$tg4.94829@vixen.cso.uiuc.edu> Subject: Re: crashes on char[] Lines: 49 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <QeH18.95370$Z2.1353672@nnrp1.uunet.ca> Date: Thu, 17 Jan 2002 16:20:38 -0500 NNTP-Posting-Host: 209.167.133.22 X-Trace: nnrp1.uunet.ca 1011302448 209.167.133.22 (Thu, 17 Jan 2002 16:20:48 EST) NNTP-Posting-Date: Thu, 17 Jan 2002 16:20:48 EST Organization: UUNET Canada News Reader Service