> 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 ?
> 
>   any chance you could be overflowing the stack? (remember, local
>   vars are put on the stack)..
> 
>   the variable 'line' will take up 1000*4 bytes (assuming pointers
>   are 4 bytes).. thats 4K.. then at 600, you have allocated 
>   600x14 bytes... thats 8K.. so that gives me a figure around 12K.
> 
>   which is probably where you stack runs out.. :) [as a rough guess]
> 
>   the code here does not state where you are running this stuff from
>   (local, global etc).. nor do you state what machine you are using
>   Palm Pro, III, IIIx or V.

        The 'line' is a global var, and the machine is IIIX. any other
good suggestion?



> 
>   try declaring the 'line' variable globally.. not locally - hence 
>   not using the stack.
> 
>   cheers.
> 
> az. 
> --
> Aaron Ardiri 
> Lecturer                       http://www.hig.se/~ardiri/
> University-College i G�vle     mailto:[EMAIL PROTECTED]
> SE 801 76 G�vle SWEDEN       
> Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
> Mob: +46 70 352 8192           A/H: +46 26 10 16 11
> 
> 

Reply via email to