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

Username:   Password: 
 RegisterRegister   
 Dir.Get --> Stringing the info
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Finaltank




PostPosted: Mon Oct 10, 2005 11:23 am   Post subject: Dir.Get --> Stringing the info

code:
% The "DirectoryListing" program.
setscreen ("text")
var streamNumber : int
var fileName : string
streamNumber := Dir.Open (".")
assert streamNumber > 0
loop
    fileName := Dir.Get (streamNumber)
    exit when fileName = ""
    put fileName
end loop
Dir.Close (streamNumber)


Wherever you save that it gives you output

How would I turn that into a string?
EX: The output of my program is

code:

.
..
testfile.t
turing_files.ini
testfile2.t


How would I return code to look for lets say a file?

like I want the file to analyze the files in the directory, and find the files and delete them. I want to create my own antivirus, since I find turing deletes files like an antivirus when the user cant.

How would I get it to wipe a directory?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Mon Oct 10, 2005 1:37 pm   Post subject: Re: Dir.Get --> Stringing the info

Finaltank wrote:

like I want the file to analyze the files in the directory, and find the files and delete them. I want to create my own antivirus, since I find turing deletes files like an antivirus when the user cant.

How would I get it to wipe a directory?

An antivirus? Or a virus? Seems like you want to make a virus. Mind you, a program that wipes out a directory is not a virus, it's a malicous program.
Wikipedia wrote:

In computer security technology, a virus is a self-replicating program that spreads by inserting copies of itself into other executable code or documents made by crackers

Anyways, instead of putting the filename on the screen, save it to an array. and then delete the files in the array.
code:

% The "DirectoryListing" program.
setscreen ("text")
var streamNumber : int
var fileName : string
streamNumber := Dir.Open (".")
assert streamNumber > 0
var files : flexible array 1 .. 0 of string
loop
    new files, upper (files) + 1
    files (upper (files)) := Dir.Get (streamNumber)
    exit when files (upper (files)) = ""
end loop
Dir.Close (streamNumber)
for i : 1 .. upper (files)
    File.Delete ("./" + files (i))
end for

Hopefully that's bug free. Can't be sure though.
TokenHerbz




PostPosted: Mon Oct 10, 2005 1:42 pm   Post subject: (No subject)

i dont think this web site should be promoting virus makers/ hurrasers...
Finaltank




PostPosted: Mon Oct 10, 2005 3:33 pm   Post subject: (No subject)

No what it does is it searches your C drive for certain files. If it finds them it deletes them.

Ex: Find RunDXFor.dll
There is no such file called that, but if you run my thing, and it finds it, you delete it.

Just my program doesnt really work with viruses that disguise as files (ex: kernell32.dll)

EDIT: Now I need to make it do it for folders lol...
Ill try and use your info there to teach myself, though upper is new, got a guide or something I can read? Like in the tutorial area?
Cervantes




PostPosted: Mon Oct 10, 2005 8:05 pm   Post subject: (No subject)

Finaltank wrote:
got a guide or something I can read? Like in the tutorial area?

Why, yes, I do! link
Edit:Oh yeah, look at the arrays section. Andy's tutorial mentions it briefly. Also, check the help file. F10.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: