On 1 Jun 2003 at 12:37, Jerry Feldman wrote: Date sent: Sun, 1 Jun 2003 12:37:09 -0400 From: Jerry Feldman <gaf@blu.org> To: suse-programming-e@suse.com Organization: Boston Linux and Unix Subject: Re: [suse-programming-e] is read() evil in usermode? [snip...]
First, these function make for somewhat unportable code. The code that I presented should work on most Unix and Linux systems (except maybe SCO), but on Windows, you might want to use the conio functions. As I created a separate function to wait for a keypress, it is best to make non-portable code into separate entities such that you can easily add that functionality on another platform. (by separate entity, I mean a separate function or macro).
-- Jerry Feldman <gaf@blu.org>
read() is pretty portable - it's POSIX compliant, so it should be available on all Unixes, and it's also available on Win32 (Ugh!). I agree with the point about keeping potentially non-portable code seperate. I/O code often falls into this category, so it's as well to get into the habit of doing it anyway, even if you don't think there are going to be any problems. alan -- http://www.ibgames.net/alan Registered Linux user #6822 http://counter.li.org Winding Down - Weekly Tech Newsletter - subscribe at http://www.ibgames.net/alan/winding/mailing.html