我引用别人的delphi代码出现这个问题
varsl:TStrings;i,n:integerbeginsl:=TStringList.Create;sl.LoadFromFile(filename);n:=sl...
var
sl: TStrings;
i,n: integer
begin
sl:= TStringList.Create;
sl.LoadFromFile(filename);
n:= sl.Count;
for i=0 to n-1 do
begin
if 0=((i+1) mod 9) then
sl[i]:= 你的字符;
end;
sl.SaveToFile(filename);
end
具体功能是替换一个文本文件中9行和9行的整数倍行为我自定义字符
出现如此错误信息:
[Error] Unit1.pas(31): Undeclared identifier: 'filename'
[Error] Unit1.pas(33): For loop control variable must be simple local variable
[Error] Unit1.pas(34): Expression expected but 'BEGIN' found
[Error] Unit1.pas(36): Illegal character in input file: '你' ($C4E3)
[Error] Unit1.pas(41): ';' expected but end of file found
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas' 展开
sl: TStrings;
i,n: integer
begin
sl:= TStringList.Create;
sl.LoadFromFile(filename);
n:= sl.Count;
for i=0 to n-1 do
begin
if 0=((i+1) mod 9) then
sl[i]:= 你的字符;
end;
sl.SaveToFile(filename);
end
具体功能是替换一个文本文件中9行和9行的整数倍行为我自定义字符
出现如此错误信息:
[Error] Unit1.pas(31): Undeclared identifier: 'filename'
[Error] Unit1.pas(33): For loop control variable must be simple local variable
[Error] Unit1.pas(34): Expression expected but 'BEGIN' found
[Error] Unit1.pas(36): Illegal character in input file: '你' ($C4E3)
[Error] Unit1.pas(41): ';' expected but end of file found
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas' 展开
1个回答
2013-11-24
展开全部
[Error] Unit1.pas(31): Undeclared identifier: 'filename'
没有定义文件名变量"filename".也许是别人程序开始有定义.你没有复制过来
[Error] Unit1.pas(33): For loop control variable must be simple local variable
[Error] Unit1.pas(34): Expression expected but 'BEGIN' found
[Error] Unit1.pas(36): Illegal character in input file: '你' ($C4E3)
编译器不认汉字.
[Error] Unit1.pas(41): ';' expected but end of file found
end后应该是分号而不是句号,检查是不是少了个end,可能会同时解决别的问题
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
建议阅读<Pascal程序设计基础>一书.了解程序的语法
没有定义文件名变量"filename".也许是别人程序开始有定义.你没有复制过来
[Error] Unit1.pas(33): For loop control variable must be simple local variable
[Error] Unit1.pas(34): Expression expected but 'BEGIN' found
[Error] Unit1.pas(36): Illegal character in input file: '你' ($C4E3)
编译器不认汉字.
[Error] Unit1.pas(41): ';' expected but end of file found
end后应该是分号而不是句号,检查是不是少了个end,可能会同时解决别的问题
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
建议阅读<Pascal程序设计基础>一书.了解程序的语法
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询