[The entire topic is not really MacPerl-specific, but I thought I'd clarify the situation] Vicki Brown <vlb@cfcl.com> writes: >At 09:20 -0500 98/06/11, Mark Manning/Simulacron I wrote: >> On the usage of OPEN with SYSREAD. You didn't read/remember my entire >> message. I said: >> >> SYSOPEN >> SYSREAD >> SYSWRITE >> CLOSE > >Someone can tell me I'm wrong, but... > >As near as I can tell going through the Camel, there is no documented >reason not to use open() with sysread() or sysopen() with read(), There isn't. >or to even assume that the sys* functions are somehow "better" than their >non-sys-prefixed counterparts, OK, here's the situation: - Every file in Perl is a stdio (buffered) stream in the C sense. - Every stdio file ultimately interacts with a nonbuffered POSIX stream (file or socket). - sysread, syswrite, and sysseek operate on the POSIX stream, read, print, seek operate on the buffered stream. - sysopen opens a POSIX stream, but immediately wraps a buffered stream around it. This means that: - streams created with open() and with sysopen() are interchangeable. - You should not mix sys- and nonsys versions of {read, write/print, seek} on the same stream. - Buffered I/O is faster or slower than nonbuffered I/O, depending on the situation. - Nonbuffered I/O is often preferrable for sockets, since it's more predictable. >> > (And why the CLOSE statement works with the rest of that stuff I have no >> > idea. I would have thought there would have been a SYSCLOSE.) There is only a single kind of file in perl. CLOSE closes both the stdio stream and the POSIX stream associated with the Perl file. Matthias ----- Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri "These days, though, you have to be pretty technical before you can even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_ ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch