[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File open modes
From: |
Norbert Nemec |
Subject: |
Re: File open modes |
Date: |
Tue, 10 Oct 2000 08:21:51 +0200 |
User-agent: |
Mutt/1.0.1i |
On Mon, Oct 09, 2000 at 06:50:53PM -0700, Quinn Dunkan wrote:
> Hmm, I didn't see Fergus' post either on the list or the newsgroup, so things
> must be getting munched somewhere.
>
> Nobbi wrote:
> > Alternative aproach: Why not have different classes for the different
> > open modes? That would be the only way that makes sense to me! (Of
> > course you still have different modes for append and create, but that
> > should be possible to handle!
You didn't reyct on this note, but I still think it is the best
solution, as it circumvents all the discussion about open-modes and
even saves the program a number of checks:
Have a INPUT_FILE, a OUTPUT_FILE and maybe a INOUT_FILE and anything
else that is needed. Each has it's appropriate open methods and all the
other methods appropriate for handling a file opened in that mode.
After all, except for a small common subset, input and output is found
in completely separate methods which could easily separated up.
As for the binary issue: The 1.3 library also has two distictive
classes TEXT_FILE and BIN_FILE. Be aware, that, in unicode, a character
need not be a byte! So you have a stream of CHARs and a stream of
OCTETs. The first one also covers the \n conversion, but it does much
more than that.
Ciao,
Nobbi
--
-- ______________________________________________________
-- JESUS CHRIST IS LORD!
-- To Him, even that machine here has to obey...
--
-- _________________________________Norbert "Nobbi" Nemec
-- Hindenburgstr. 44 ... D-91054 Erlangen ... Germany
-- eMail: <address@hidden> Tel: +49-(0)-9131-204180