C
caoliu
Unregistered / Unconfirmed
GUEST, unregistred user!
这是我的代码
for i:=0 to FileListBox1.Items.Count-1 do
begin
assignfile(txt1,FileListBox1.items);
reset(txt1);
assignfile(txt2,Edit1.txt);
if fileExists(Edit1.txt) then
append(txt2)
else
rewrite(txt2);
writeln(txt2,head1,head2:15,head3:15,head4:12,head5:18,
head6:10,head7:10,head8:15,head9:10,head10:21,head11:10,head12:11);
while not eof(txt1) do
begin
readln(txt1,Status,Trunk,Number,Dialed,Time,Callstop,
Ccode,OutTrunk,OutChannel,StopDate);
if Status='S ' then
writeln(txt2,Trunk,Dialed,Callstop,OutTrunk,StopDate);
end;
closefile(txt1);
closefile(txt2);
end;
请看:
assignfile(txt2,Edit1.txt);fileExists(Edit1.txt)
或者为assignfile(txt2,savedialog1.filename);fileExists(savedialog1.filename) 时我通过Savedialog1 写文本时只能放在D:/的根目录下
(我的源文件在D:/的根目录的一个文件夹中)如果放在其它地方,编译运行报'file not find'
在reset(txt1);这步出问题.
如果把assignfile(txt2,Edit1.txt),fileExists(Edit1.txt) 分别改为assignfile(txt2,'D:/Tools/1234.txt'),fileExists('D:/Tools/1234.txt') 或E:/temp/123.txt时一切OK.
这是怎么回事,我解决不了,望个位富翁指点,谢谢!
for i:=0 to FileListBox1.Items.Count-1 do
begin
assignfile(txt1,FileListBox1.items);
reset(txt1);
assignfile(txt2,Edit1.txt);
if fileExists(Edit1.txt) then
append(txt2)
else
rewrite(txt2);
writeln(txt2,head1,head2:15,head3:15,head4:12,head5:18,
head6:10,head7:10,head8:15,head9:10,head10:21,head11:10,head12:11);
while not eof(txt1) do
begin
readln(txt1,Status,Trunk,Number,Dialed,Time,Callstop,
Ccode,OutTrunk,OutChannel,StopDate);
if Status='S ' then
writeln(txt2,Trunk,Dialed,Callstop,OutTrunk,StopDate);
end;
closefile(txt1);
closefile(txt2);
end;
请看:
assignfile(txt2,Edit1.txt);fileExists(Edit1.txt)
或者为assignfile(txt2,savedialog1.filename);fileExists(savedialog1.filename) 时我通过Savedialog1 写文本时只能放在D:/的根目录下
(我的源文件在D:/的根目录的一个文件夹中)如果放在其它地方,编译运行报'file not find'
在reset(txt1);这步出问题.
如果把assignfile(txt2,Edit1.txt),fileExists(Edit1.txt) 分别改为assignfile(txt2,'D:/Tools/1234.txt'),fileExists('D:/Tools/1234.txt') 或E:/temp/123.txt时一切OK.
这是怎么回事,我解决不了,望个位富翁指点,谢谢!