随笔 - 2146  文章 - 97 评论 - 11765 trackbacks - 253

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  万一  阅读(...)  评论(... 编辑 收藏