[DUG] StrCopy problem

Ross Levis ross at stationplaylist.com
Sun May 12 14:45:49 NZST 2013


Doesn't really help.

 

a := 'abcdefghi' does allocate 9 bytes of RAM.  I can access a and b after
it is assigned.  The problem is StrCopy crashes.  I would expect "a" to have
the same string as b once this is executed.

 

Ross.

 

From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Keith Allpress
Sent: Sunday, 12 May 2013 10:27 AM
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] StrCopy problem

 

Perhaps:

http://rvelthuis.de/articles/articles-pchars.html

 

 

From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Ross Levis
Sent: Sunday, 12 May 2013 2:39 a.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] StrCopy problem

 

var

  a: pChar;

  b: pChar;

begin

  a := 'abcdefghi';

  b := 'jklmnopqr';

  StrCopy(a,b);

end;

 

Question:  Why does this code crash?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20130512/efd2bc2f/attachment.html 


More information about the Delphi mailing list