Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Offset 00H. The first field in a normal (nonextended) FCB is the disk
  drive identifier. Values for the drive identifier start at 1; a value of 1
  indicates drive A, 2 indicates drive B, and so on. If this field contains
  0 at the time an FCB is opened, DOS uses the current default drive and
  updates this field with the corresponding drive identifier.

  Offsets 01H and 09H. The two fields at offsets 01H and 09H contain an
  8-byte name and a 3-byte extension. These fields are left-justified and
  padded on the right with blanks. Following DOS convention, either upper-
  or lowercase letters may be used. If the filename is a device name that
  DOS recognizes, such as CON, AUX, COM1, COM2, LPT1, LPT2, PRN, or NUL, DOS
  will use that device rather than a disk file.

  --------------------------------------------------------------------------
  NOTE:
    This is a reasonably good place to point out that the FCB mechanism has
    no provision for working with pathnames. Whenever you use FCBs, they
    always apply to the current directory in any drive. For flexible use of
    paths and subdirectories, see the new, extended functions in Chapter
    17.
  --------------------------------------------------------------------------

  Offsets 0CH and 20H. For sequential file operations, the current-block and
  current-record fields keep track of the location in the file. The use of
  these fields is rather odd. Instead of using one integrated record number,
  the record number is divided into a high and low portion, referred to as
  the block number and record number. The record number is a 7-bit value, so
  record numbers range from 0 through 127. Thus the first record in a file
  is block 0, record 0; the 128th record is block 1, record 0.

  Before you use the sequential read and write functions 14H and 15H, be
  sure to initialize the current block and record fields to the desired
  starting location in the file.

  Offset 0EH. The record-size field contains a 2-byte value that specifies
  the size, in bytes, of the logical records in the file. When DOS reads or
  writes a record, the logical size of the record is the number of bytes
  transferred between DOS's disk buffers and the DTA.

  The same file data can be worked on using a variety of record sizes. When
  a file is opened through functions 0FH or 16H, DOS sets the record size to
  128 bytes by default. If you want another size, such as 1 for single-byte
  operations, you must change the record-size field after the file is
  opened.

  Offset 10H. The file-size field at offset 10H indicates the file size in
  bytes. The value is taken from a file's directory entry and is placed in
  the FCB when DOS opens the file. For an output file, this field is changed
  by DOS as the file grows. When the file is closed, the value is copied
  from the FCB to the file's directory entry.

  By changing this field, you can gain some last-minute control over the
  size of an output file, but be careful when doing this. You can, for
  example, truncate a file you have updated by decreasing the file-size
  value in this field. Also, be careful not to use function 17H to rename an
  open file: This function requires that you specify the file's new name in
  the same part of the FCB used for the file size.

  Offsets 14H and 16H. The 2-byte fields at offset 14H (date) and offset 16H
  (time) record when a file was last updated. These fields use the same
  format as the corresponding fields in a directory entry. (See Chapter 5.)
  The initial values in these fields are copied from a file's directory
  entry when the file is opened. They are subsequently updated each time you
  write to the file. If the file was updated, DOS copies the values from the
  FCB to the directory entry when the file is closed.

  Offset 21H. The random-record field is used during random read and write
  operations, just as the current record and block numbers are used during
  sequential operations. This field is in the form of a 4-byte, 32-bit
  integer. Records are numbered from 0, which makes it easy to calculate the
  file offset to any record by multiplying the random-record number by the
  record size. You must set this field before any random file operation. DOS
  leaves it undisturbed.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson