Re: It seems simple...

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hey, guess I must of missed this one so when I saw the last post
I thought I'd put my pennies worth in.

--Begin Code

include get.e
include file.e

object junk
integer fn, file_length, pointer
sequence seq

 fn = open(filename , "rb")
 junk=seek(fn,-1)
 file_length=where(fn)
 pointer = file_length - 128
 junk=seek(fn,pointer)

 seq=repeat(0,128)

 for x = 1 to 128 do
     seq[x] = getc(fn)
 end for

-- End Code

If this wont work, somebody please let me know.

BEWARE UNTESTED CODE
euman at bellsouth.net

----- Original Message -----
From: Brian <impee3 at EXCITE.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, December 13, 2000 1:11 PM
Subject: It seems simple...


> I'm trying to open a binary file for read only, go to the last 128 bytes
in
> the file, and read that string. Seems simple, right? I'm at the point
where
> I can't find an equivalent Euphoria routine that I'd use if I were writing
> this in VB. In VB, I'd use -- FileLen(FileName) - 127 -- to do what I'm
> trying. I tried to use get_bytes, but to no avail. Can anybody send me a
> snippet of code that'll do what I need?
>
> Seek() would work fine for moving the placement of the next reading to 128
> bytes from the end of the file, but getting the actual length of the file
is
> where I'm stuck.
>
> Thanks,
> Brian
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu