Re: getc() ?? bug

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

----- Original Message -----
From: "Bernie" <xotron at PCOM.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Tuesday, November 21, 2000 3:57 AM
Subject: Re: getc() ?? bug


> On Mon, 20 Nov 2000 14:00:05 +1100, Derek Parnell <derekp at SOLACE.COM.AU>
> wrote:
> >So blame the DOS designers. The interpreter is not wrong in this case.
How
> >can it know that for this specific text file, the ASCII-26 is not to be
> >interpreted as EOF, but on others it is? And just because DOS has a glyph
> >assigned to ASCII-26, does mean that it is a "printable" character
> according
> >to ASCII or ANSI.
> >
> >Anyhow, the Euphoria behaviour is already documented. Here is an extract
> >from the open() documentation.
>
>
>    I still disagree.
>
>    I should be able to open ANY disk file in ANY mode and read it and it
>    should NEVER return -1 or EOF UNTIL it reaches the very end of the
>    file and at no other time NO MATTER what text it contains look at
>    the DOS interrupts the AX register indicates when it reachs an EOF.

I agree with you, but the DOS designers have copied this protocol from CP/M
and that is the documented way that DOS is supposed to operate. It is
stupid, yes. But Euphoria is only implementing the DOS standard.

>    The context of the file should have nothing to do with it.
True, I also believe that the context *should* have nothing to do with it,
but unfortunately is *does*.

>    The reason that euphoria is wrong is because it is trying to use the
>    same function to get input from the keyboard.

Sorry, but I don't get the connection? If you type in Ctrl-Z (ASCII-26) then
getc(0) will return -1. This is totally consistent, because stdin is a DOS
"text" device. To get the raw data from the keyboard is to open("CON", "rb")
but even this is not perfect solution, because a single Ctrl-Z on a line is
interpreted as EOF.

In summary I believe that Euphoria is correct because it is implementing the
DOS standard. I think it is the DOS standard that has got it wrong. Unix has
 no concept of binary/text files - they're all the same.

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu