🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #79

Re: file positioning with buffered/unbuffered I/O

#79
From: Charlie Wilkinson
Date: Mon, 10 Aug 1992 20:27
51 lines
3290 bytes
phil@cs.utexas.edu (Philip Smolen) writes:
: In article <1992Aug6.154146.11988@irscscm.UUCP> cwilkins@irscscm.UUCP (Charlie Wilkinson) writes:
: [Lots deleted]
: >My book (The MSC Bible 2nd edition) says
: >that although none of these functions are ANSI compliant, almost all of them
: >can be used with every compiler.  The exception being that some are not
: >Unix and/or Xenix compatible.
 
: I thought these WERE the unix file utilities.  (as opposed to the ansi
: file utilities)  According the Borland C++ 3.1 online help, only eof()
: is not ANSI compliant.  eof() can be avoided with lseek() and tell().
 
Well the MSC BIBLE (which is undisputably 100% true in all respects)  ;-)
says the following about compatability:

	MSC MSC MSC MSC QC QC  QC TC  TC TC TC      UNIX            
          3   4   5   6  1  2 2.5  1 1.5  2 ++ ANSI SYSV XNX OS2 DOS
====================================================================
close()   Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
creat()   Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
dup()     Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
dup2()    Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
eof()     Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    N   N   Y   Y
lseek()   Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
open()    Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
read()    Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y
sopen()   Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    N   N   Y   Y
tell()    Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    N   N   Y   Y
write()   Y   Y   Y   Y  Y  Y   Y  Y   Y  Y  Y    N    Y   Y   Y   Y

: IMHO the Unix file utilities are easier to use than the corresponding
: ANSI ones.

I haven't used low level I/O a whole bunch, so I'm still a bit shakey with
it, but once I got past some of the quirks (If you open a file for writing,
you must also explicitly specify that you want write permissions on the file,
or you get an error when attempting to write to it.) life got easier.  
I found it to be much faster than using the high level "fopen()" stuff, in
some cases by a magnitude of 10+, well into the hundreds of kbytes/sec!

: Since the DOS system level file utilities are so similar to the Unix
: system level file utilities, it seems like the Unix style file access
: should be the most effecient way to access files from DOS.

Sounds good to me.    :-)

--
cwilkins@irscscm.uucp                                   /======================\
uunet!mimsy!prometheus!media!ka3ovk!irscscm!cwilkins    | Micro-Sig(tm) pellet |
N3HAZ@KA3RFE.MD.USA.NA                                  |   -just add water    |
...or you can call me Charlie                           \======================/
Technical Details
Message-ID: <1992Aug10.202755.3898@irscscm.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!aplcen.apl.jhu.edu!wb3ffv!ka3ovk!irscscm!cwilkins
References: <l85skiINN9vb@levelland.cs.utexas.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!aplcen.apl.jhu.edu!wb3ffv!ka3ovk!irscscm!cwilkins
From: cwilkins@irscscm.UUCP (Charlie Wilkinson)
Newsgroups: alt.msdos.programmer,comp.lang.c,comp.os.msdos.programmer
Subject: Re: file positioning with buffered/unbuffered I/O
Message-ID: <1992Aug10.202755.3898@irscscm.UUCP>
Date: 10 Aug 92 20:27:55 GMT
References: <l85skiINN9vb@levelland.cs.utexas.edu>
Organization: Internal Revenue Service
Lines: 51