unit URcrdIO;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, dbtables;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMyRec = record
MyArray: array[1..1000] of char;
mystr: string;
end;
var
Form1: TForm1;
MyRec: TMyRec;
mylist: TStringlist;
PMyChar: PChar;
myfile: file;
mb: TStream;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
assignfile(myfile, 'c:\testblob.txt');
rewrite(myfile, 1);
fillchar(MyRec.MyArray, sizeof(MyRec.MyArray), #0);
pmychar := @MyRec.MyArray;
StrPCopy(pmychar, memo1.text);
Blockwrite(MyFile, MyRec, SizeOf(MyRec));
closefile(MyFile);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
assignfile(myfile, 'c:\testblob.txt');
reset(myfile, 1);
fillchar(MyRec.MyArray, sizeof(MyRec.MyArray), #0);
Blockread(MyFile, MyRec, SizeOf(MyRec));
pmychar := @MyRec.MyArray;
Memo1.SetTextBuf(pmychar);
end;
end.
|