Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Basic Drive Exploring
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
copthesaint




PostPosted: Tue Mar 10, 2009 11:32 am   Post subject: Basic Drive Exploring

This basic program explores your computer.

Turing:
var BackNext, NextFind, num, NumOfDir : int := 0
var fileName : string
var FoldersHotlink : array 0 .. 100000 of string
var size, attr, fileTime, dir : int
var NextDrive, DriveHotlink : array 0 .. 25 of string := init ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')
var TRUEFALSEDRIVE : array 0 .. 25 of int
View.Set ("Graphics:max;max")

proc GetDrives (truefalse : boolean)
    NumOfDir := 0
    for i : 0 .. 25
        Dir.Change (NextDrive (i) + ":/")
        if Error.Last = 0 then
            NumOfDir += 1
            DriveHotlink (NumOfDir) := Dir.Current
            if truefalse = true then
                put DriveHotlink (NumOfDir), " ", (NumOfDir)
            end if
        else
            DriveHotlink (i) := ""
        end if
    end for
    if truefalse = true then
        get num
    end if
end GetDrives

proc GetLongDir (DirGet : string)
    NumOfDir := 0
    dir := Dir.Open (DirGet)
    loop
        Dir.GetLong (dir, fileName, size, attr, fileTime)
        exit when fileName = ""
        put fileName : 22, " " ..
        if (attr and attrDir) not= 0 then
            put "   [DIR] " ..
            NumOfDir += 1
            put "   ", NumOfDir ..
            FoldersHotlink (NumOfDir) := fileName
        end if
        put ""
    end loop
    Dir.Close (dir)
end GetLongDir

proc ExploreDrives
    GetDrives (false)
    loop
        cls
        put Dir.Current
        GetLongDir (Dir.Current)
        NumOfDir += 1
        put "Change Drive ", NumOfDir
        num := 0
        for i : 1 .. NumOfDir
            if num < 1 or num > NumOfDir then
                get num
            end if
            if num = i then
                if num = NumOfDir then
                    GetDrives (true)
                    Dir.Change (DriveHotlink (num))
                else
                    Dir.Change (FoldersHotlink (i))
                end if
                exit
            end if
        end for
    end loop
end ExploreDrives

ExploreDrives
Sponsor
Sponsor
Sponsor
sponsor
hossack




PostPosted: Wed Mar 11, 2009 7:33 am   Post subject: RE:Basic Drive Exploring

Not bad
Tallguy




PostPosted: Wed Mar 11, 2009 7:39 am   Post subject: RE:Basic Drive Exploring

sweet, i like how you did it, good job
copthesaint




PostPosted: Wed Mar 11, 2009 6:37 pm   Post subject: RE:Basic Drive Exploring

Yea I am Btw making A full program that wil explore any drive and allow you to open picture and text files, But It will take a week to do because I need to make all my Gui.
It does already open .txt and .bmp, .jpg, .gif files but as I said it won't be finished for probably another week. (Ill need to make a slider bar Gui, and Buttons Gui Once I have done that I will upload the program.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: