|
-
September 15th, 2009, 01:11 PM
#3
Re: String Copy
While that almost looks like a placement new (which I doubt you want) initially, what it is actually doing is tossing away your pointer to the:
new char[10]
and assigning pB to point to the constant character array of "aaa". Typically, that array will be located in memory marked as READ ONLY, so when you try to write to it, you are getting the exception of writing to invalid memory.
It will also leak the allocation of the new char[10].
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|