Joey Mukherjee wrote:
>
....
> However, is O_BINARY a standard flag for open? Adding that flag on Solaris
> seems to fail in compile since that symbol is not defined or mentioned in
> the open man page. I'd hate to add #ifdef around every open...
>
I thought it was "standard", but a search of the man pages and include files on a
Solaris system failed to find "O_BINARY" and a web search of Linux man pages also
failed
to find O_BINARY mentioned on the open() page. So you may have to define it for
environments you know don't have it.
> Why is text mode the default for open? Wouldn't one use fopen for text
> processing and open for binary?
C on DOS/Windows was made to look as much like UNIX as possible (baring the
text/binary mode issue). On UNIX, fopen() is a function that provides more
"efficient" disk
processing by doing reads/writes in chunks and parceling out/collecting the data
from/to buffers in user space. It uses the open() system call to do all the actual
I/O.
As to why text mode is the default, I believe (this is suppostion only!) that the
assumption was made that user level applications would normally be working with text
so it
should be the "usual" mode.
--
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
[EMAIL PROTECTED]
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple