The code compiles fine.
The problems is that when the code reaches the delete command i get an error.
"Heap Corruption Detected"
"CRT detected that the application wrote to memory after end of heap buffer."
I have no clue how to solve this problem.
Any help is appreciated.
Thanks,
phoenix1990
A couple of things: You shouldn't mix malloc and delete: Either use new/delete or malloc/free.
Second thing is add one to strsize when you allocate your string for the null byte. Remember, arrays are zero-based, so your valid indices are 0 to strsize - 1.
You shouldn't mix malloc and delete: Either use new/delete or malloc/free.
Is strsize is anything other than zero, you're writing over memory that isn't yours, because encode points to enough memory for one char only.
Thanks for the help kooth and Moschops.
Your comments really help me to resolve all the issues i was having with the code.
Now everything works perfectly.
Thankyou guys.