定义一个加密解密函数
function Encode(s:string):string ;
var
n,i :integer ;
str:string ;
begin
n:=length(s) ;
str:= '' ;
for i:=1 to n do
begin
str :=str+ char(ord(s[i])-1) ;
end;
encode:=str ;
end;
function Decode(s:string):string ;
var
n,i:integer ;
str:string ;
begin
n:=length(s);
str:= ' ' ;
for i:=1 to n do
begin
str:=str+char(Ord(s[i])+1) ;
end;
Decode:=str ;
end;
======
打开文本
=========
procedure TForm1.OpenClick(Sender: TObject);
var
Textvar : Textfile ;
TextLine :string ;
begin
if opendialog1.Execute then
begin
MemoB.Clear ;
caption:= '文本加密器' +Opendialog1.FileName ;
AssignFile(TextVar,Opendialog1.FileName) ;
Reset(TextVar) ;
while not eof(TextVar) do
begin
ReadLn(TextVar,TextLine);
MemoB.Items.Add(textLine);
end;
closefile(TextVar) ;
end;
end;=====
加密是出错
procedure TForm1.EncodeClick(Sender: TObject);
begin
Memob.Items:=Encode(Memob.Items ) ;
end;
========Missing operator or semicolon
错误信息 如何解决?
function Encode(s:string):string ;
var
n,i :integer ;
str:string ;
begin
n:=length(s) ;
str:= '' ;
for i:=1 to n do
begin
str :=str+ char(ord(s[i])-1) ;
end;
encode:=str ;
end;
function Decode(s:string):string ;
var
n,i:integer ;
str:string ;
begin
n:=length(s);
str:= ' ' ;
for i:=1 to n do
begin
str:=str+char(Ord(s[i])+1) ;
end;
Decode:=str ;
end;
======
打开文本
=========
procedure TForm1.OpenClick(Sender: TObject);
var
Textvar : Textfile ;
TextLine :string ;
begin
if opendialog1.Execute then
begin
MemoB.Clear ;
caption:= '文本加密器' +Opendialog1.FileName ;
AssignFile(TextVar,Opendialog1.FileName) ;
Reset(TextVar) ;
while not eof(TextVar) do
begin
ReadLn(TextVar,TextLine);
MemoB.Items.Add(textLine);
end;
closefile(TextVar) ;
end;
end;=====
加密是出错
procedure TForm1.EncodeClick(Sender: TObject);
begin
Memob.Items:=Encode(Memob.Items ) ;
end;
========Missing operator or semicolon
错误信息 如何解决?
解决方案 »
- delphi 7 点击cxgrid后 新增数据时报错?
- 读取一个PNG图形(一个时钟指针形状),并进行旋转!
- property(特性)和Field(字段,属性)有什么区别
- 可以把TClientWinSocket换成TTcpClient吗?
- 救急: 如何将MySql的数据库转到MS Sql 2000中去???
- DELPHI里面有没有字符串包含的函数,即检查一个子串有没有包含在字符串里面
- 高手指教:本人刚刚要开发b/s结构的mis系统,如何开发?
- 怎样实现播放当前目录的wav文件?100分
- 有关ListBox的一个问题
- delphi 读取注册表多字符串 (REG_MULTI_SZ)
- 帮我想想思路
- delphi 急
试试看