|
Home > Archive > Unix Programming > April 2004 > fopen, open & binary mode
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
fopen, open & binary mode
|
|
|
|
| Villy Kruse 2004-04-20, 4:34 am |
| On Tue, 20 Apr 2004 10:46:06 +0300,
Alex Vinokur <alexvn@big.foot.com> wrote:
> fopen() accept binary modes "rb", "wb", ...
> Does open() have similar thing?
>
> For instance, http://www.scit.wlv.ac.uk/cgi-bin/mansec?2+open doesn't contain "binary".
>
Old C compilers for MSDOS used to support a O_BINARY flag for the open() call.
Villy
| |
| Chuck Dillon 2004-04-20, 12:35 pm |
| Alex Vinokur wrote:
> fopen() accept binary modes "rb", "wb", ...
> Does open() have similar thing?
The "b" support is for strict compliance to ISO C. On UNIX it has *no
effect*. Your fopen man page should make those points. If such a mode
existed for open() it also would have no effect.
-- ced
>
> For instance, http://www.scit.wlv.ac.uk/cgi-bin/mansec?2+open doesn't contain "binary".
>
> --
> Alex Vinokur
> mailto:alexvn@connect.to
> http://mathforum.org/library/view/10978.html
>
>
>
--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
| |
|
|
| Villy Kruse 2004-04-20, 12:35 pm |
| On Tue, 20 Apr 2004 16:44:50 +0300,
Alex Vinokur <alexvn@big.foot.com> wrote:
>
> I have tested than on Cygwin (Cygwin is a Linux-like environment for Windows).
> Fo Cygwin a binary mode essentially improves performance.
>
That is expected considering that when reading a text file every occurence
of CRLF pairs must be replaced by a single \n character before representing
the data to the user program.
>
> I don't know if it is truth for "pure" UNIX (not on Windows).
>
In pure unix there is no difference between binary and text file and
therefore no proformance difference either.
Villy
| |
|
| On Tue, 20 Apr 2004 16:44:50 +0300, Alex Vinokur wrote:
>
> "Chuck Dillon" <cdillon@nimblegen.com> wrote in message news:c6389q$2q4$1@grandcanyon.binc.net...
>
> I have tested than on Cygwin (Cygwin is a Linux-like environment for Windows).
> Fo Cygwin a binary mode essentially improves performance.
>
> http://article.gmane.org/gmane.comp...+.perfometer/45 (Raw run log)
> http://article.gmane.org/gmane.comp...+.perfometer/44 (Source)
>
> I don't know if it is truth for "pure" UNIX (not on Windows).
>
> [snip]
>
> --
> Alex Vinokur
> mailto:alexvn@connect.to
> http://mathforum.org/library/view/10978.html
Be careful, because in cygwin, you can mount paths in a binary mode or a
text mode. Then when you open files, you can use binary or text. It can
all be rather confusing.
--Mac
|
|
|
|
|