var
i: integer;
f: TextFile;
p: pchar;
line: string;
begin
p := @data;
line := '';
AssignFile(f, filename);
Rewrite(f);
for i := 0 to count - 1 do
begin
if (i mod 16 = 0) and (line <> '') then
begin
Writeln(f, line);
line := '';
end;
line := line + 'qwerty' + HexChar[(Ord(p[i]) shr 4) and $F] +
HexChar[(Ord(p[i]) and $F)] + ',';
end;
if line <> '' then
Writeln(f, line);
CloseFile(f);
end;
我想自定义输入QWERTY怎么弄,在窗体上放了EDIT2
var
i: integer;
f: TextFile;
p: pchar;
line: string;
begin
p := @data;
line := '';
AssignFile(f, filename);
Rewrite(f);
for i := 0 to count - 1 do
begin
if (i mod 16 = 0) and (line <> '') then
begin
Writeln(f, line);
line := '';
end;
line := line + EDIT2.TEXT + HexChar[(Ord(p[i]) shr 4) and $F] +
HexChar[(Ord(p[i]) and $F)] + ',';
end;
if line <> '' then
Writeln(f, line);
CloseFile(f);
end;
编译出错
i: integer;
f: TextFile;
p: pchar;
line: string;
begin
p := @data;
line := '';
AssignFile(f, filename);
Rewrite(f);
for i := 0 to count - 1 do
begin
if (i mod 16 = 0) and (line <> '') then
begin
Writeln(f, line);
line := '';
end;
line := line + 'qwerty' + HexChar[(Ord(p[i]) shr 4) and $F] +
HexChar[(Ord(p[i]) and $F)] + ',';
end;
if line <> '' then
Writeln(f, line);
CloseFile(f);
end;
我想自定义输入QWERTY怎么弄,在窗体上放了EDIT2
var
i: integer;
f: TextFile;
p: pchar;
line: string;
begin
p := @data;
line := '';
AssignFile(f, filename);
Rewrite(f);
for i := 0 to count - 1 do
begin
if (i mod 16 = 0) and (line <> '') then
begin
Writeln(f, line);
line := '';
end;
line := line + EDIT2.TEXT + HexChar[(Ord(p[i]) shr 4) and $F] +
HexChar[(Ord(p[i]) and $F)] + ',';
end;
if line <> '' then
Writeln(f, line);
CloseFile(f);
end;
编译出错
[Error] Unit1.pas(54): Undeclared identifier: 'edit2'
[Error] Unit1.pas(54): '(' expected but '+' found
[Error] Unit1.pas(54): Incompatible types
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
错误提示
如果不定义filename ,可以用一个文件,格式是:'c:\test.txt'形式。
2、@data 从哪里来的?@是取地址用的,那data从何而来?提示: edit2没有定义,缺少 '(' 号如果有问题,请详细说明,或者贴出全部源代码。
跟标题不知道有什么关系
其实是EDIT2没有定义,所以只能用line := line + FORM1.EDIT2.TEXT + HexChar[(Ord(p[i]) shr 4) and $F] +
HexChar[(Ord(p[i]) and $F)] + ',';