Re: (No Subject)

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

At 11:55 PM 4/26/98 -0700, Mathew Hounsell wrote:
>
>File Input Routines...
>I use getc instead of gets as it doesn't forget the last line if there is
no EOL
>marker.
>(Dave: EE does lose last line.)

This is close to being a *bug* in Euphoria, or at least a
real puzzle. I just tried this:

object s
atom fn
fn = open("TEST.TXT","r")
while 1 do
  s = gets(fn)
  if atom(s) then exit
  end if
  puts(1,s)
end while

It reads and prints all the lines in my test file, *including* the
last line which does NOT end in a linefeed or c/r. (I checked
it with a hex editor - in fact, made test files with 4 different
editors, plus the dos "copy con test.txt" command)
Lots of times, however, the same code _has_ dropped
the last line. Whazzup?
(I know about using getc in a loop, but why go to all
 that trouble? This is supposed to be a high level
 language.)

Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu