home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / alt / msdos / programm / 3278 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.1 KB  |  43 lines

  1. Newsgroups: alt.msdos.programmer
  2. Path: sparky!uunet!news.univie.ac.at!scsing.switch.ch!ira.uka.de!sol.ctr.columbia.edu!spool.mu.edu!agate!linus!alliant!merk!spdcc!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!ralf
  3. From: Ralf.Brown@B.GP.CS.CMU.EDU
  4. Subject: Re: How do I get starting sector of file?
  5. In-Reply-To: <1jo1afINNps3@gap.caltech.edu>
  6. Message-ID: <2b601151@ralf>
  7. Originator: ralf@B.GP.CS.CMU.EDU
  8. Sender: news@cs.cmu.edu (Usenet News System)
  9. Nntp-Posting-Host: b.gp.cs.cmu.edu
  10. Organization: Carnegie Mellon University School of Computer Science
  11. Date: Fri, 22 Jan 1993 14:22:57 GMT
  12. Lines: 29
  13.  
  14. In article <1jo1afINNps3@gap.caltech.edu>, jkubicky@cco.caltech.edu (Joseph J. Kubicky) wrote:
  15. }I want to know how to read the starting sector of a file.  I also
  16. }want to know how to create a sequential file of fixed length.  I want
  17. }to do all this so I can do more direct I/O to the disk and (hopefully)
  18. }realize some performance gains over normal DOS or C-lib file I/O functions.
  19.  
  20. I doubt that a 3-5% performance increase will be worth the effort and
  21. possible incompatibilities of bypassing DOS....  You can get around 97%
  22. of the theoretical maximum throughput using only DOS services if you
  23.    a) use large reads (at least 32K at a time),
  24.    b) do all reads in multiples of the sector size (thus transferring
  25.        directly between your buffer and disk, without going through
  26.        the DOS disk buffers),
  27.    c) ensure enough disk buffers to keep the FAT in memory
  28. and
  29.    d) keep the disk defragmented.
  30.  
  31. Having said that, you can determine the starting cluster of a file from
  32. its directory entry; to get that, you should use the old-style FCB
  33. findfirst/findnext calls (INT 21/AH=11h,12h).  Then, get the DOS Disk
  34. Parameter Block for the drive with INT 21/AH=1Fh or INT 21/AH=32h,
  35. and compute the starting sector based on the number of the first data
  36. sector and the number of sectors per cluster.
  37.  
  38. -- 
  39. Internet: RALF+@CS.CMU.EDU   |The University would disclaim this if it knew...
  40. FIDO: Ralf Brown 1:129/26.1  |
  41. BIT: RALF%CS.CMU.EDU@CARNEGIE|"Fall seven times, stand up eight."
  42. AT&Tnet: (412)268-3053 school|   -- Japanese proverb
  43.