{OS.read ... } and STDIN
Johann Höchtl
big.john at bigfoot.com
Thu May 16 14:41:05 CEST 2002
Hello !
Given the following small 'programm'
local
ReadList
ReadList2
STDIN = {OS.fileDesc 'STDIN_FILENO'}
in
{OS.read STDIN 3 ReadList _ _}
{OS.read STDIN 3 ReadList2 _ _ }
{Show ReadList}
{Show ReadList2}
end
and executed within the OPI, behaves IMHO a quite strange.
Suppose when the first {OS.read STDIN 3 ReadList _ _}is reached, I enter
Hi
into the emulator window in emacs. The buffer now contains "Hi" and the
Tailpos returns 2. Two Elements have been read, everything is fine.
But the second {OS.read STDIN 3 ReadList2 _ _ } does not block, but
immediately rutrns a single '10'.
I suspect there is sthg wrong concerning cr/lf handling vs a single lf
(or is it cr? ) in the UNIX world. I can be wrong but i have currently
no acces to a unix box to verify this.
Is this a limitation of Mozart on a Windows box ? I know that there is
also {Open.text ...}. Will this behave as expected ?
BTW: I think the OS - module lacks a flush function. When you enter eg
10 bytes but read only 3 than the first call to read would yield the
first 3 characters, while the next call to read would return the
remaining 7 *but this time an appended '10'* (lf or cr ?)
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
More information about the mozart-users
mailing list