Content deleted Content added
No edit summary |
Matthiaspaul (talk | contribs) Added a note on DR-DOS dynamic assignment of handles. Improved some links. |
||
Line 1:
A '''File Control Block''' ('''FCB''') is a file system structure in which the state of an open [[Computer file|file]] is maintained. An FCB is managed by the operating system, but it resides in the memory of the program that uses the file, not in operating system memory. This allows a program to have as many files open at one time as it wants to, provided it can spare enough memory for an FCB per file.
The FCB originates from [[CP/M]] and is also present in most variants of [[DOS]], though only as a backwards compatibility measure in [[MS-DOS]] versions 2.0 and later. A full FCB is 36 bytes long; in early versions of CP/M, it was 33 bytes. This fixed size, which could not be increased without breaking application compatibility, lead to the FCB's eventual demise as the standard method of accessing files.
The meanings of several of the fields in the FCB differ between CP/M and
{|class="wikitable"
|-
Line 9:
|-
| 00
|align=right| 1 || Drive number — 0 for default, 1 for A:, 2 for B:, ...
|-
| 01
Line 29:
==Usage==
In CP/M and MS-DOS 1 (which did not include support for [[directory (file systems)|subdirectories]]), the FCB was the only method of accessing files. When subdirectories were introduced in MS-DOS 2, FCBs proved too small to handle the extra data required for that, and thus were superseded by [[file
If a program uses the newer file handle API to open a file, the operating system will manage its internal data structure associated with that file in its own memory area. This has the great advantage that these structures can grow in size in later operating system versions without breaking compatibility with application programs; its disadvantage is that, given the rather simplistic [[memory management]] of MS-DOS and its compatibles, space for as many of these structures as the most "file-hungry" program is likely to use has to be reserved at boot time and cannot be used for any other purpose while the computer is running. Such memory reservation is done using the [[FILES (CONFIG.SYS directive)|FILES]]=
FCBs were supported in all versions of MS-DOS and [[Microsoft Windows|Windows]] until the introduction of the [[
The FCB interface does not work properly on [[Windows NT]], [[Windows 2000|2000]], etc. either - WordStar does not function properly on these operating systems. DOS emulators [[DOSEMU]] and [[DOSBox]] implement the FCB interface properly, thus they are a way to run older DOS programs that need FCBs on modern operating systems.
|