In a dll I allocate memory for an array of char* :<br>ppChar = new char*[ y ];<br>When I try to free it I get an error :<br>delete [] ppChar;<br>What is my mistake ? Thank you.<br>
Dear Gilles,<br><br>> When I try to free it I get an error <br><br>What is the error? This works in VC 6 without any errors:<br><br>char** pbuf = new char*[10];<br>delete [] pbuf;<br><br>-pete<br>
Thank you Pete,<br>Actually, my code looks more like :<br><br>short i;<br>char** pbuf = new char*[100];<br><br>for(i=0; i<=100; i++)<br>{<br> pbuf<i> = new char[100];<br>}<br><br>for(i=0; i<=100; i++)<br>{<br> delete [] pbuf<i>;<br>}<br> <br>delete [] pbuf;<br><br><br>This last line yields the following error :<br><br>Damage: after Normal block (#192) at 0x01BE0180<br><br>Thank you for your help.<br>Gilles<br>
Sorry, but i indexes don't appear in my previous <br>message as they are interpreted as italic signals.<br>Here is a new version :<br><br>Thank you Pete,<br>Actually, my code looks more like :<br><br>char** pbuf = new char*[100];<br>short k;<br><br>for(k=0; k<100; k++)<br>{<br> pbuf[k] = new char[100];<br>}<br><br>for(k=0; k<100; k++)<br>{<br> delete [] pbuf[k];<br>}<br> <br>delete [] pbuf;<br><br><br>This last line yields the following error :<br><br>Damage: after Normal block (#192) at 0x01BE0180<br><br>Thank you for your help.<br><br>Gilles<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.