J
jacob navia
Mr said:Do you find fopen() absurd and impossible to use too? Or are file or
stream attributes (such as the POSIX permission bits, or O_EXCL) less
important to you than some of the thread attributes that POSIX or
Windows have?
That prompted me to study a bit the history of fopen(). Where does it
come from? When was the first version of fopen?
The oldest version of it that I found a reference to was in the first
Unix Manual: (http://cm.bell-labs.com/cm/cs/who/dmr/man31.pdf)
mov $filename , r0
jsr r5,fopen; iobuf
It is dated from Nov 3rd 1971. It says in the "Bugs" section:
For greater speed, the buffer should be 512 bytes long. Unfortunately,
this will cause several existing programs to stop working.
!!!
In 1978 things are already well in place:
(http://plan9.bell-labs.com/7thEdMan/index.html)
NAME
-fopen, freopen, fdopen - open a stream
SYNOPSIS
#include <stdio.h>
FILE *fopen(filename, type)
char *filename, *type;
DESCRIPTION
fopen opens the file named by filename and associates a stream with it.
fopen returns a pointer to be used to identify the stream in subsequent
operations.
Type is a character string having one of the following values:
"r" open for reading
"w" create for writing
"a" append: open for writing at end of file, or create for writing
----------------------------------------------------------------------
The interface of fopen has then at least 33 years. A whole professional
life.
When designing interfaces NOW, taking as an example fopen() one of the
oldest interfaces still in use is not really a good idea.
Considerations that then were crucial (small RAM footprint, efficiency,
etc) aren't of such an importance now, with machines that have 3 or 4
orders of magnitude more RAM and much more power.