Computer Science Canada

I Need Desprate help with directories

Author:  Antsabee [ Thu Dec 22, 2005 9:16 pm ]
Post subject:  I Need Desprate help with directories

I have a Problem Turing 3.1.1A
how do you set directories?, everytime
I try I either crash the program or
my computer Confused can someone show
me a quick snipit of what opening a
directory should look like or give me
some tips on how it works???

Author:  do_pete [ Thu Dec 22, 2005 10:58 pm ]
Post subject: 

code:
var streamNumber : int
var directory : string

put "Enter directory: " ..
get directory :*
streamNumber := Dir.Open (directory)

loop
        var fileName : string
        Dir.Get (streamNumber, fileName)
        exit when fileName = ""
        put fileName
end loop

This should work

Author:  do_pete [ Thu Dec 22, 2005 11:03 pm ]
Post subject: 

Dammit I forgot this:

Dir.Close (streamNumber)

stick it at the end

Author:  Mr. T [ Fri Dec 23, 2005 1:43 am ]
Post subject:  Alex's Opinion

Still doesn't work. Says Dir.Get can't have parameters.

Author:  do_pete [ Fri Dec 23, 2005 11:01 am ]
Post subject: 

Oh that's right, sorry I got mixed up between Dir.Get and Dir.GetLong and I diddn't have turing at that moment. You should go like this:
code:
var streamNumber : int
var directory : string

put "Enter directory: " ..
get directory : *
streamNumber := Dir.Open (directory)

loop
    var fileName : string
    fileName := Dir.Get (streamNumber)
    exit when fileName = ""
    put fileName
end loop

Dir.Close (streamNumber)

Author:  Antsabee [ Fri Dec 23, 2005 4:28 pm ]
Post subject: 

but what exactly does this directory string look like?? and does the directory browser change to fit?? Question

Author:  Antsabee [ Fri Dec 23, 2005 4:33 pm ]
Post subject: 

OOO WOW allright the directory browser is a useless piece of garbage, thanks guys you were a big help!!! Very Happy


: