home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 4
/
CDPD_IV.bin
/
e
/
mailinglists
/
binaries
/
readstr-study.lha
/
ReadStr-std-3.e
< prev
next >
Wrap
Text File
|
1993-07-24
|
552b
|
24 lines
MODULE 'dos/dos'
PROC readStr (handle, buffer)
/* Differs from E's ReadStr() in that it returns the string's length. */
DEF bytes, strMax, eoln
strMax := StrMax (buffer)
bytes := Read (handle, buffer, strMax)
eoln := InStr (buffer, '\n', 0)
IF eoln > -1
Seek (handle, -(bytes - eoln - 1), OFFSET_CURRENT)
buffer [eoln] := 0
ELSE
buffer [bytes] := 0
eoln := IF bytes = 0 THEN -1 ELSE bytes
ENDIF
ENDPROC eoln
PROC main ()
DEF s [5] : STRING
WHILE readStr (stdout, s) > -1
WriteF ('s=\s\n', s)
ENDWHILE
ENDPROC