Re: getc() function and end of file

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

Could you use something like this?

include get.e
include file.e

object junk
integer fn, file_length
sequence seq
seq = {}

 fn = open(" file_name " , "r")
 junk=seek(fn,-1)     
 file_length=where(fn)
 junk=seek(fn,0)

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

Euman

----- Original Message ----- 
From: "Ted Fines" <fines at macalester.edu>
To: "EUforum" <EUforum at topica.com>
Sent: Friday, April 06, 2001 16:40
Subject: getc() function and end of file


> 
> 
> Hello all,
> 
> I'm trying to process a file, an image of a disk, actually.  The file is 
> about 1,450,000 bytes.
> 
> Anyway, my program always stops after only reading about 38,400 bytes.  It 
> appears that getc(infile) is returning -1 (a ctrl-Z presumably), causing 
> the program to quit.
> 
> The thing is, its nowhere near the end of the file yet.  How can I make 
> getc(infile) keep going until it really reaches the end of the file?  Do I 
> have to first look at the D_SIZE attribute from the dir() function, then 
> use a for loop to read all of the data, or is there another way?
> 
> Thanks,
> Ted Fines
> Macalester College
> 
> 
> 
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu