On Wed, 21 Jul 1999 16:38:49 +0800 (HKT) [EMAIL PROTECTED] wrote:
> > ----- Original Message -----
> > From: Eric Siu <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 21, 1999 1:03 AM
> > Subject: Re: bus error
> >
> >
> > > > On Wed, 21 Jul 1999, Eric Siu wrote:
> > > >
> > > > > I want to directly assign string to a array of charptr, like the
> > > > > following,
> > > > >
> > > > > CharPtr line[1000];
> > > > > UInt i;
> > > > >
> > > > > for (i=0;i<1000;i++){
> > > > > line[i]=MemPtrNew(14);
> > > > > StrCopy(Q9Word[i],"today is fine");
> > > > > }
> > > > >
> > > > > when the i is up to 600, the emulator say "bus error", what's the
> > problem?
> > > > > or any other way to directly assgin a string to a CharPtr ?
> > > >
> >
> > Have you considered checking the result of MemPtrNew()? StrCopy'ing to
> NULL > will send your bus to the bodyshop.
> 
> atually, I am a new deleloper of Palm program. How to check the
> MenPtrNew() ?

This not actually rocket science and has more to do with C than with the Palm. If 
MemPtrNew() return NULL then your allocation has failed and you shouldn't be copying 
data into that array element.

Maybe we could split this list into C questions and Palm specific questions.

Chris


This message sent using EMUmail.  http://EmuMail.com

Reply via email to