主题:请问如何判断一个文件是否存在???
			
 xlsp
				 [专家分:20]  发布于 2005-10-05 15:20:00							
			如题!!谢谢
						
					 
		
			
回复列表 (共5个回复)
		
								
				沙发
				
					
林记 [专家分:1680]  发布于 2005-10-05 18:21:00				
				请看以下帖子:
[url=http://www.programfan.com/club/showbbs.asp?id=98701]http://www.programfan.com/club/showbbs.asp?id=98701[/url]
							 
						
				板凳
				
					
阿Ben [专家分:2200]  发布于 2005-10-05 18:30:00				
				使用DOS单元的FSearch函数。
例:
uses dos;
var
 s:PathStr;   {路径类型}
begin
 s:=FSearch('TURBO.EXE','C:\TP\BIN');  {在C:\TP\BIN中寻找文件“TURBO.EXE”}
 if s='' then writeln('File not found!')
   else writeln('Congratulation! File has found!');  {如果“TURBO.EXE”不存在,则输出“File not found”,否则……}
end.
							 
						
				3 楼
				
					
xlsp [专家分:20]  发布于 2005-10-05 19:42:00				
				谢谢!!!
							 
						
				4 楼
				
					
阿Ben [专家分:2200]  发布于 2005-10-06 17:55:00				
				不用谢!
							 
						
				5 楼
				
					
lidaminy [专家分:60]  发布于 2006-02-09 19:45:00				
				什么单元都不用
var
 i:file;
 path:string;
begin
 readln(path);
 assign(i,path);
 {$I-}
 reset(i);
 {$I+}
 Write('File ');
 if ioResult<>0
 then write('not ');
 write('exist');
end.
							 
									
			
我来回复