<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Your answer is in the help file<br>
      <p class="Element10">
        <i>Use StrCopy to copy Source to Dest. StrCopy returns Dest. &nbsp;</i></p>
      <i>
      </i>
      <p class="Element10"><i>
          StrCpy does not perform any length checking. The destination
          buffer must have room for at least </i><i><a
href="http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/SysUtils_StrLen@PAnsiChar.html">StrLen</a></i><i>(Source)+1
          characters.&nbsp;</i></p>
      <i>
      </i>
      <p class="Element10"><i>
          For length checking, use the </i><i><a
href="http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/SysUtils_StrLCopy@PAnsiChar@PAnsiChar@Cardinal.html">StrLCopy</a></i><i>
          function. &nbsp;</i></p>
      <i>
      </i><i><strong></strong></i><i><br>
      </i><br>
      D<br>
      <br>
      <br>
      On 12/05/13 14:45, Ross Levis wrote:<br>
    </div>
    <blockquote cite="mid:007f01ce4eba$d0c2e440$7248acc0$@com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 3 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">Doesn&#8217;t really help.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">a := 'abcdefghi' does
            allocate 9 bytes of RAM.&nbsp; I can access a and b after it is
            assigned.&nbsp; The problem is StrCopy crashes.&nbsp; I would expect
            &#8220;a&#8221; to have the same string as b once this is executed.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">Ross.</span><span
            style="font-size:12.0pt;color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"
                  lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"
                lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
                [<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On
                  Behalf Of </b>Keith Allpress<br>
                <b>Sent:</b> Sunday, 12 May 2013 10:27 AM<br>
                <b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
                <b>Subject:</b> Re: [DUG] StrCopy problem<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
        <p class="MsoNormal"><span style="color:#1F497D">Perhaps:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><a
              moz-do-not-send="true"
              href="http://rvelthuis.de/articles/articles-pchars.html">http://rvelthuis.de/articles/articles-pchars.html</a><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span
                lang="EN-US"> <a moz-do-not-send="true"
                  href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
                [<a moz-do-not-send="true"
                  href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>]
                <b>On Behalf Of </b>Ross Levis<br>
                <b>Sent:</b> Sunday, 12 May 2013 2:39 a.m.<br>
                <b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
                <b>Subject:</b> [DUG] StrCopy problem<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">var<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">&nbsp; a: pChar;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">&nbsp; b: pChar;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">begin<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">&nbsp; a := 'abcdefghi';<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">&nbsp; b := 'jklmnopqr';<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">&nbsp; StrCopy(a,b);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">end;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D">Question:&nbsp; Why does
            this code crash?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
    </blockquote>
    <br>
  </body>
</html>