各位大侠:
我在编程时:
(var commamd:string)
var str:Tstringlist;
command:='command.com /c nbtstat -a '+nmtime1.LocalIP+' >d:\temp.txt';
winexec(pchar(command),sw_hide);
str.LoadFromFile('d:\temp.txt');
但,str.loadfromfile('d:\temp.txt') 总是大打不开 temp.txt
出错提示:cannot open file temp.txt,但,temp.txt 存在呀!并可双击打开!
请于解决!!
我在编程时:
(var commamd:string)
var str:Tstringlist;
command:='command.com /c nbtstat -a '+nmtime1.LocalIP+' >d:\temp.txt';
winexec(pchar(command),sw_hide);
str.LoadFromFile('d:\temp.txt');
但,str.loadfromfile('d:\temp.txt') 总是大打不开 temp.txt
出错提示:cannot open file temp.txt,但,temp.txt 存在呀!并可双击打开!
请于解决!!
解决方案 »
- 在Win2k3 server上安装DELPHI7所遇到的问题
- 在image中画东东,背景色是白色的,如何改变image的背景色?
- 邮件发送的问题
- 各位大侠帮帮忙delphi6 mysql2000;
- ado连接excel的问题,若能解决,分不够再加!
- ***一个奇怪的小问题!!
- 关于ADO连接问题?(在线等待,马上结贴)
- 出售一些编程书,欢迎看看。
- 有搞底层通讯,知道TMSComm,和MSCommLib_TLB单元的兄弟吗?告诉我那里可以找到这些东西!分马上给!waiting!
- 在c/s结构中,到底用不用数据敏感控件?
- 等侍!等侍!请求帮助!不要嫌我烦呀!谢谢!
- 请问怎样用DELPHI去连接DB2的数据库?
command:='command.com /c nbtstat -a '+nmtime1.LocalIP+' >d:\temp.txt';
winexec(pchar(command),sw_hide);
str := TStringList.Create;
str.LoadFromFile('d:\temp.txt');
str.Free;
马上就执行了 str.LoadFromFile('d:\temp.txt');
这时temp.txt还没创建呢,当然打不开,可以这样:
str := TStringList.Create;
command:='command.com /c nbtstat -a 192.101.104.176 >d:\temp1.txt';
winexec(pchar(command),sw_hide);
// 等待文件生成
while not FileExists('d:\temp1.txt') do Application.ProcessMessages;
// 延时1秒(多少时间自己掌握)
Sleep(1000);
str.Lines.LoadFromFile('d:\temp1.txt');
command:='command.com /c nbtstat -a '+nmtime1.LocalIP+' >d:\temp.txt';
winexec(pchar(command),sw_hide);
str.LoadFromFile('d:\temp.txt');
问题是你没有创建STR的实例但你虽然声明了。str:=tstringlist.create;
祝:
身体健康
答案和分数同样重要!!
while not FileExists('d:\temp1.txt') do Application.ProcessMessages; Sleep(1000);
但还没出错过.有点意义.