Re: a good ASCII Character map?

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

Hello LEVIATHAN

I submitted the below example to the list for a prior question on reading 80
bytes at a time from a file

I'm still confused as to why you would need an
EOF Char before the end of the file.

Because, if there were an EOF Char there would be no
way to read past that point, rendering the rest of the file
useless.

I am not sure but, you could try to useing seek.
Kat mentioned one way, Pad the file to a certain length
that way you could use the below example real easy
by replaceing 80 (in the example) with the length you need.

</snip>

include get.e
include file.e

object junk
atom ad
integer fn, file_length, last_n_bytes
sequence seq
seq = {}

 fn = open(" filename_here.ext" , "rb")
 junk=seek(fn,-1)
 file_length=where(fn)
 junk=seek(fn,0)

 ad = floor(file_length / 80 )
 last_n_bytes = file_length - (ad * 80)

 for x = 1 to ad do
     seq = append(seq, get_bytes(fn, 80))
 end for

 seq = append(seq, get_bytes(fn, last_n_bytes))

<snip\>

if this still isnt what you want, send me a couple of the
files your working with and I certainly will take a look.

euman at bellsouth.net


----- Original Message -----
From: "LEVIATHAN" <leviathan at USWEST.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, January 14, 2001 06:28
Subject: Re: a good ASCII Character map?


> Heya!
>
> > seek to the end of the file, grab the length of the file (in bytes) and
> > store the length value in the file
> >
> > i.e: {{{3}123},{{4}1234}}
> >
> > I want to help, so give me an example.
>
> Basically, I'm trying to stick an EOF before the EOF, aka "trimming
> the file". Nothing I tried, including 26 and 255 and even -1 worked,
> so I'm pretty stuck on trying to trim the file like that. Can you help?
>
> TIA,
>
> --"LEVIATHAN"
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu