Posted: Tue May 30, 2006 8:08 pm Post subject: Detecting Files?
Does turing have code for detecting files? My program creates files but it also has the delete file functionality. So, would I need a separate file with all the filenames saved in it, or is there some way I can directly list the files in a certain directory?
Sponsor Sponsor
Guest
Posted: Tue May 30, 2006 9:01 pm Post subject: Listing Directory
Here's a little fun program I made:
code:
%Directory Listing Program
loop
var winID := Window.Open ("graphics:0;0")
var dir : string
setscreen ("text")
put "Enter a directory ('.' for current, '..' for back): " ..
get dir : *
put ""
var streamNumber := Dir.Open (dir)
var num : int
var fileName : string
var q : char
for i : 1 .. streamNumber
fileName := Dir.Get (streamNumber)
put fileName
exit when fileName = ""
end for
Dir.Close (streamNumber)
put "Press any key to exit " ..
Input.Pause
Window.Close (winID)
end loop
[/code]
Cervantes
Posted: Tue May 30, 2006 9:04 pm Post subject: (No subject)
Also, File.Exists may be of help to you. At least, that's what first came to mind when I was reading your question, though it seems to me now that the Dir module is what you're looking for.