Drive / Volume read Question

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Drive / Volume read Question

Post by andyh1234 » Fri Feb 15, 2008 1:43 pm

Ive got an old app written in VB on a PC that scans a drive (or memory card etc - basically any mounted volume) byte by byte, so I can put in a string and the app just looks for it.

Its a neat way to find a file i've deleted in the past, once found I just grab x bytes either side and dump them in a file which I can look at later.

Is there any way to do a byte by byte read of a volume in Revolution as I would love to rewrite it in Rev so I could use it on a mac and expand it, just not sure what the syntax would be to open a volume, get its size and then read it in.

Thanks!

Andy

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Fri Feb 15, 2008 5:34 pm

Runrev itself does not allow byte level access to the filesystem, you'd need an external or a shell command which allows that to do it.

If you just want to get filenames and/or file contents, read these entries in the documentation:

DefaultFolder
Files
Folders
answer file
answer folder
Open File
Read from File
Close File
URL
put

for reading a whole file at once, it's often simpler to use URL, instead of open/read/close file:

Code: Select all

on mouseUp
  answer file "Any file will do"
  if it = "" or the result <> "" then --user canceled
    exit mouseUp
  end if
  put url ("binfile:" & it) into theBinaryData
  --do stuff here with the Data you got now
end mouseUp
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Sat Feb 16, 2008 12:28 pm

Thanks, Ill go and see if I can work out an external command as its files that have been deleted that I want to scan the drive for, maybe just re-write the interface in rev.

Andy

Post Reply