| Author | 
		Message | 
	
		 
		uberwalla
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 6:59 pm    Post subject: File In Use  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Hey I was just wondering if there is a way to tell through turing if there is a file in use. just to give an example of what i mean. You go to delete your c:/ drive but and then it stops and says file in use.
 
 
is there a way to tell if a file is/ isnt in use? | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		ericfourfour
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 7:43 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Since you cannot delete a file that is in use this program might do the trick. This is straight out of the manual at File.Delete.
 
	  | code: | 	 		  % The "File.Delete" program.
 
const pathName : string := "myfile.txt"
 
 
% Create file
 
var f : int
 
var line : string
 
open : f, pathName, put
 
put : f, "There is a line here"
 
close : f
 
put pathName, " created"
 
 
% Delete the file
 
File.Delete (pathName)
 
if Error.Last = eNoError then
 
    put skip, pathName, " deleted"
 
else
 
    put skip, "Did not delete ", pathName
 
    put "Error: ", Error.LastMsg
 
end if
 
  | 	 
  | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		uberwalla
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 7:49 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				ok thx. i think that works   i dont wanna actually test it on one of my files because it might not be in use   but ok ty | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		uberwalla
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 7:53 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				ok sorry for double post but for some reason the help section (of all forums    ) doesnt have edit button    
 
 
anyways when u said skip was an actual command so i looked it up in reference to get its actual definition in full. 
 
 
my question is:
 
if i were to delete many files at once using turing; this say: 1.txt, 2.txt, and 3.txt
 
 
if 1.txt was in use would the skip command tell it to skip to the next file (2.txt)?
 
 
because in skips definition it says that it just skips a line. like the "/n" in front of text in quotations does.
 
 
thx. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		Clayton
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 8:09 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| No, skip would not skip that file. Like the help manual says, it simply skips a line in the run window. If you wanted to skip a file, just use an if statement. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		uberwalla
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 8:20 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				thats the problem i dont know how   lol
 
 
is there a command that skips a file? like 
 
if filename = inUse then
 
    File.Skip (filename)?????
 
end if
 
 
it doesnt work but   is there a command like that   especially the inuse one would be most useful   lol | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Dec 19, 2006 8:31 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| you just have to catch the error / exception, and continue on with the loop | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		 |