Article View: borland.public.cppbuilder.nativeapi
Article #10495Re: CopyMemory API problem
From: Bob Gonder
Date: Mon, 12 Apr 2004 23:09
Date: Mon, 12 Apr 2004 23:09
28 lines
1814 bytes
1814 bytes
Martin C wrote:
>I am using the following code to free memory on my machine, although I
>always get access violation once the CopyMemory function is reached, can
>someone help me please and tell me what exactly I am doing wrong.
>int Granularity;
> AnsiString strTemp;
> strTemp = Granularity;
Can you do that? Assign an int to a string?
And why convert it back again?
> ReadAddress = StrToInt(strTemp);
> ShowMessage(Granularity);
>
> CopyMemory(&WriteAddress, &ReadAddress, Granularity); // Error shows
>here
Check the actual values of all three parameters.
You might be trying to access memory you aren't entitled to.
Also check to make sure you arn't doing this:
{help}
"If the source and destination blocks overlap, the results are
undefined. For overlapped blocks, use the MoveMemory function. "
Technical Details
Message-ID:
<5v7m701261mpcjc68up9v6m226cd698sq8@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40786e5f@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,aeea745eda602570 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-12 16:31:10 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: CopyMemory API problem Date: Mon, 12 Apr 2004 16:09:53 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <5v7m701261mpcjc68up9v6m226cd698sq8@4ax.com> References: <40786e5f@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 4.227.148.94 X-Trace: newsgroups.borland.com 1081811391 4.227.148.94 (12 Apr 2004 16:09:51 -0800) Lines: 31 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail