{"id":951,"date":"2010-03-12T22:37:00","date_gmt":"2010-03-12T02:37:00","guid":{"rendered":""},"modified":"2013-11-17T16:48:19","modified_gmt":"2013-11-17T08:48:19","slug":"%e5%a6%82%e4%bd%95%e5%b0%86string%e5%8f%98%e9%87%8f%e8%b5%8b%e5%80%bc%e7%bb%99pchar%e5%8f%98%e9%87%8f","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/951.html","title":{"rendered":"\u5982\u4f55\u5c06String\u53d8\u91cf\u8d4b\u503c\u7ed9PChar\u53d8\u91cf"},"content":{"rendered":"<p>\u8fd9\u4e2a\u95ee\u9898\uff0c\u5e94\u8be5\u662f\u6bcf\u4e2a\u4f7f\u7528Delphi\u7684\u670b\u53cb\u7ecf\u5e38\u4f1a\u9047\u5230\u7684\u7591\u95ee\uff0c\u9488\u5bf9\u5982\u4f55\u5c06String\u53d8\u91cf\u8d4b\u503c\u7ed9Pchar\u53d8\u91cf\uff0c\u7f51\u4e0a\u6709\u5f88\u591a\u79cd\u8bf4\u6cd5\uff0c\u5982PChar\u3001StrPas\u3002\u4f46\u7ecf\u8fc7\u6211\u5b9e\u9645\u8bd5\u7528\uff0c\u53d1\u73b0\u4ee5\u4e0b\u95ee\u9898\u3002\u5982\u679c\u4f60\u611f\u5174\u8da3\uff0c\u53ef\u4ee5\u5728\u4f60delphi7\u7f16\u8bd1\u4e0b\u9762\u4e8c\u6bb5\u4ee3\u7801\uff0c\u770b\u5176\u7ed3\u679c\u6709\u4f55\u4e0d\u540c\uff1f<\/p>\n<p>\u4ee3\u78011<\/p>\n<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nvar  p : pchar;  s : string;  i  : integer;\r\nbegin\r\n   s := 'hello world';\r\n   i  := length(s);\r\n   GetMem(p,i);\r\ntry\r\n   p := PChar(s);\r\nfinally\r\n   FreeMem(p);  \/\/\u6b64\u5904\u4f1a\u51fa\u9519\r\nend;\r\nend;\r\n<\/pre>\n<p>\u4ee3\u78012<\/p>\n<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nvar  p : pchar;  s : string;  i  : integer;\r\nbegin\r\n   s := 'hello world';\r\n   i  := length(s);\r\n   GetMem(p,i);\r\ntry\r\n   StrPCopy(p,s);\r\nfinally\r\n   FreeMem(p);  \/\/\u53ef\u4ee5\u6b63\u786e\u91ca\u653e\r\nend;\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u95ee\u9898\uff0c\u5e94\u8be5\u662f\u6bcf\u4e2a\u4f7f\u7528Delphi\u7684\u670b\u53cb\u7ecf\u5e38\u4f1a\u9047\u5230\u7684\u7591\u95ee\uff0c\u9488\u5bf9\u5982\u4f55\u5c06String\u53d8\u91cf\u8d4b\u503c\u7ed9Pchar\u53d8\u91cf\uff0c\u7f51 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-951","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=951"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/951\/revisions"}],"predecessor-version":[{"id":4704,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/951\/revisions\/4704"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}