Reading from a UNIX volume..
Alex Rice
alrice at ARCplanning.com
Tue Aug 12 08:07:00 EDT 2003
On Monday, August 11, 2003, at 11:21 PM, Jim Witte wrote:
> open file "/dev/rdisk3" for binary read
> put the result into item 1 of ret
> * read from file "/dev/rdisk3" for 4096 -- until EOF
> put the result into item 2 of ret
> put it into fld "rtext"
> close file "/dev/rdisk3"
> put the result into item 3 of ret
>
> The script as written works, but if I change the starred line to
> 'until EOF' it doesn't - it gives a result code of 'eof' for the read
> command. Does EOF do strange things if the thing you're reading from
> is a volume, and not a "real" file (whatever real means). Is there a
> better way to read directly from a volume other doing a file read from
> /dev/* ?
Maybe the volume is larger than you can read in one operation, maybe
some internal buffer size that Rev has? Try something like this
repeat ... read from file "/dev/rdisk3" at (512 * n) for 512
Or try "read from driver" instead. The docs have examples of "read from
driver" reading from /dev files. Maybe it handles EOF differently?
OTO maybe read that's wrong and read from file is for block devices and
read from driver is for stream devices?
Alternatively you should shell() to use dd or cp to get the data from
the device.
Interesting question!
Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com
More information about the use-livecode
mailing list