> what's wrong with my code?

I don't know.  You didn't provide enough information to run it and try it out.
However, I suspect the following:

* You need to change "temp = new char(intarray[j])" to "temp = new char
[intarray[j]]".  The former creates a new "char" object, initializes it to the
value in intarray[j].  However, later you treat the result as an array of chars,
so I think you need the latter construction.

* You need to update your version of the emulator.  I don't know of a way to get
the error message you reported with the current version.

* You need to re-enable all the options in the Debug Options dialog.  Poser will
normally detect the type of memory heap corruption you're causing.  But if
what's going on is what I suspect is going on, you've turned off this error
checking.

-- Keith Rollin
-- Palm OS Emulator engineer






hymanho <[EMAIL PROTECTED]> on

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  hymanho <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/US/PALM)
Subject:  Error when run project in POSE



Following is one function in my C++ project , when I run it in the POSE, the
error message was shown:"During a regular checkup, Poser detemined that the
dynamic heap chunk with header address 0x0001FB7C got corrupted. Some unused
flags were set to '1'". what's wrong with my code?

void ConstructCharsArr(CharPtr data)
{
     int i=0,j=0;
     char *temp;

     while (true)
     {
          if (j == TotalFields)
               break;

          temp = new char(intarray[j]);

          for (i=0;i<intarray[j];i++)
          {
               temp[i] = *(data + i);
          }

          Ddata[j] = temp;
          data = data + intarray[j];
          j++;
     }
}





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to