其他分享
首页 > 其他分享> > SysUtils.StrAlloc、SysUtils.StrBufSize

SysUtils.StrAlloc、SysUtils.StrBufSize

作者:互联网

SysUtils.StrAlloc、SysUtils.StrBufSize

StrAlloc   : 给 PChar 指针分配空间, 并填充 #0;
StrBufSize : PChar 缓冲区大小.
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  p: PChar;
  i: Integer;
begin
  p := StrAlloc(10);

  StrCopy(p, '123456');
  ShowMessage(p); {123456}

  i := StrBufSize(p);
  ShowMessage(IntToStr(i)); {10}

  StrDispose(p);
end;

end.
SysUtils 单元下的公用函数目录

posted on 2008-05-13 13:43  万一  阅读(2683)  评论(0)  编辑  收藏

标签:PChar,end,TForm1,SysUtils,StrBufSize,StrAlloc
来源: https://blog.51cto.com/u_14617575/2746259