Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #7952

fopen

From jacob navia <jacob@spamsink.net>
Newsgroups comp.lang.c
Subject fopen
Date 2011-07-08 12:59 +0200
Organization lccwin
Message-ID <iv6nv4$9db$1@speranza.aioe.org> (permalink)

Show all headers | View raw


Mr wojtek_l@yahoo.ca (Wojtek Lerch) wrote:

 > 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.

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

fopen jacob navia <jacob@spamsink.net> - 2011-07-08 12:59 +0200
  Re: fopen Ian Collins <ian-news@hotmail.com> - 2011-07-08 23:06 +1200
    Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 04:40 -0700
      Re: fopen Ian Collins <ian-news@hotmail.com> - 2011-07-08 23:46 +1200
        Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 05:15 -0700
          Re: fopen Seebs <usenet-nospam@seebs.net> - 2011-07-08 14:47 +0000
            Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 08:18 -0700
            Re: fopen Angel <angel+news@spamcop.net> - 2011-07-08 19:37 +0000
              Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 13:02 -0700
      Re: fopen Seebs <usenet-nospam@seebs.net> - 2011-07-08 14:47 +0000
        Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 08:29 -0700
          Re: fopen Seebs <usenet-nospam@seebs.net> - 2011-07-08 15:55 +0000
            Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 09:19 -0700
              Re: fopen Seebs <usenet-nospam@seebs.net> - 2011-07-08 17:21 +0000
              Re: fopen Keith Thompson <kst-u@mib.org> - 2011-07-08 13:39 -0700
                Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-08 17:17 -0700
                Re: fopen Keith Thompson <kst-u@mib.org> - 2011-07-08 17:39 -0700
                Re: fopen Seebs <usenet-nospam@seebs.net> - 2011-07-09 06:04 +0000
                Re: fopen China Blue Dolls <chine.bleu@yahoo.com> - 2011-07-09 01:39 -0700
          Re: fopen Ian Collins <ian-news@hotmail.com> - 2011-07-09 08:23 +1200
          Re: fopen Dr Nick <3-nospam@temporary-address.org.uk> - 2011-07-09 07:47 +0100
          Re: fopen Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-07-09 06:55 -0700
            Re: fopen Nobody <nobody@nowhere.com> - 2011-07-10 05:26 +0100
              Re: fopen Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-07-10 02:33 -0700
    Re: fopen James Kuyper <jameskuyper@verizon.net> - 2011-07-08 08:18 -0400
      Re: fopen Ian Collins <ian-news@hotmail.com> - 2011-07-09 08:18 +1200
      Re: fopen Dr Nick <3-nospam@temporary-address.org.uk> - 2011-07-09 07:52 +0100
  Re: fopen Todd Carnes <toddcarnes@gmail.com> - 2011-07-08 13:10 +0000
    Re: fopen BGB <cr88192@hotmail.com> - 2011-07-08 12:25 -0700

csiph-web