用这句 Reset(TF);
会出现下面错误,这是为什么!?---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EInOutError with message 'I/O error 32'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
会出现下面错误,这是为什么!?---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EInOutError with message 'I/O error 32'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
解决方案 »
- finally except 的问题!
- 如何倒序取字符串的呢?很实际的问题
- 才接触api!有很多不明白的地方???请前辈门帮助!
- 急急!谁有有关拨号方面和有关FTP上传方面的控件???
- delphi6的ActionList是不是有bug?
- 初学delphi,请问怎么做报表呢??应该用那些东西啊??
- 一个傻问题,为什么我调用最简单的dll的函数老是报pointer opretion error?
- 一个数据库问题,关于sql语句的,在线等待啊!
- 怎样读取任意一个文件的ascii码呢|?
- 请问在Delphi程序中是怎样表示方向键的,如:if DownArrowCode then ExecSelfCode.
- query带参向数据表中添加数据的问题!
- 菜鸟问题....xpmenu.dcu 丢失.....在线等 急救!!!
//*************************************************
//编译过程,编译成功返回TURE,编译失败返回FALSE.
//filename:需编译的*.C文件,refilename:保存结果,保存CONSOLE 程序的输出,
Function mycompile(filename,refilename:string;handle:Thandle):boolean;
var s,s1:string;
ch:char;
i,j:integer;
TF:TextFile;
begin
try
DeleteFile(refilename);
s:='/c C:\turboc2\tcc -exxx '+filename+'>'+refilename;
i:=ShellExecute(handle, 'open', PChar('command.com'), PChar(s), nil, SW_hide);
if i<= 32 then
begin
result:=false; showmessage('1;');
exit;
end
else
begin
j:=0;
sleep(1);
while not FileExists(refilename) do
begin
sleep(50);
j:=j+1;
if j=20 then
begin
result := false; showmessage('2;');
exit;
end;
end;
AssignFile(TF,refilename) ;
Reset(TF);
s1:='';
while not Eof(TF) do
begin
read(TF,ch);
s1:=s1+ch;
end;
closefile(TF);
DeleteFile(refilename);
if (pos('Error',s1)<>0) or (pos('not',s1)<>0) or (pos('error',s1)<>0) then
begin
result := false; showmessage('3;');
exit;
end
else
begin
result := true;
exit;
end;
end;//end if i>32
except
result := false; showmessage('4;');
exit;
end;
end;
你先检查一下你执行
AssignFile(TF,refilename) ;
Reset(TF);
时文件有没有真正存在,如果存在的话
由于你的文件是用重定向生成的,检查一下打开时,它有没有被关闭.还有,
while not FileExists(refilename) do
begin
sleep(50);
j:=j+1;
if j=20 then
begin
result := false; showmessage('2;');
exit;
end;
end;
这段是用来延时的吧,时间够吗?
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EInOutError with message 'I/O error 32'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------该异常说明: 32 Sharing violation (共享错误)即是说还有其它程序打开了该文件没有关闭.可能是shellExecute产生该文件后没有关闭.
var
SI: TStartupInfo;
PI: TProcessInformation;
begin
FillChar(sI,sizeof(sI),#0);
sI.cb := SizeOf(sI); // CREATE_NEW_CONSOLE or
si.dwFlags:=STARTF_USESTDHANDLES; //or STARTF_USESTDHANDLES
SI.wShowWindow := SW_hide;
s:='cmd.exe /k C:\turboc2\tcc -exxx '+filename+'>'+refilename;
//i:=ShellExecute(handle, 'open', PChar('command.com'), PChar(s), nil, SW_hide); --以前用这个DOS窗口不会显示出来.
CreateProcess(nil,pchar(s),nil,nil,false,NORMAL_PRIORITY_CLASS, nil, nil, sI, pI) ; --现在DOS窗口会显示出来.
end;怎么使DOS窗口不显示出来, SI.wShowWindow := SW_hide; 这样不行吗!?