You are corrupting your heap...


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]

Posted by Arm on July 29, 1999 at 20:15:52:

In Reply to: weird errors posted by ack!! on July 29, 1999 at 20:01:48:

You are allocating less memory than you need, and running off the end of your allocated block, thus trashing your heap.

I'd bet you have a line of code that looks like:

char *name = new char[strlen(Name)];

if you look closely, you'll see you have one *less* byte than you need to store that string...

Try:

char *name = new char[strlen(Name)+1];

and see if your problems go away. 95% of the time, they should...

hth,
-A





Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]