Board index » delphi » Including a header in a file

Including a header in a file

Hi... I am writing a database program that writes all its data into a
RECORD FILE.  Everyone works fine except when I try to include a header
in the file - I realized I'll have to put the header on every single
record!  I don't want to do that.  Does anyone know how to do it without
putting the header on all the records?  Please reply by e-mail or
posting.  Thanks!

--
 **************************************************************************
              xx
             / .|_      "{*word*221} CHICKEN RULES!"               Adrian Pang
            /(_)_<                             adri...@vcn.bc.ca
           /   (
  ((____.-.     )
   \\._._._'`  /
     \       /
       ------
 **************************************************************************

 

Re:Including a header in a file


Quote
> Hi... I am writing a database program that writes all its data into a
> RECORD FILE.  Everyone works fine except when I try to include a header
> in the file - I realized I'll have to put the header on every single
> record!  I don't want to do that.  Does anyone know how to do it without
> putting the header on all the records?

   You'll have to use an untyped file and BlockWrite from a buffer you
manage - construct the header info and as many database records as
possible into the buffer and BlockWrite as much data as you've put there.
With a "database", you'll probably have to "block" numerous records into
the buffer (which can be as large as 64K).
   The above is incomplete, because it's a lot of coding, but it's the
sort of thiung you'll have to do to work with "mixed data" files.  
Remember to ReWrite the file with a record size of 1 (2nd parameter).

Re:Including a header in a file


Quote
Adrian Pang (adri...@vcn.bc.ca) wrote:

: Hi... I am writing a database program that writes all its data into a
: RECORD FILE.  Everyone works fine except when I try to include a header
: in the file - I realized I'll have to put the header on every single
: record!  I don't want to do that.  Does anyone know how to do it without
: putting the header on all the records?  Please reply by e-mail or
: posting.  Thanks!

The easiest way is to put the header in another file - e.g., with a .HDR
extension, and read the header first, before reading the data file. The
header file can be an ascii file or in a binary format or whatever.

The Chief
--------
Dr. A{*word*73}la A. Olowofoyeku (The African Chief)
Email: la...@keele.ac.uk
Author of: Chief's Installer Pro 2.91 for Win16 and Win32:
           Winner of PC PLUS Magazine Gold Award (April 1995 U.K. edition)
           http://ourworld.compuserve.com/homepages/African_Chief/chief.htm

Re:Including a header in a file


In article <5281d4$...@milo.vcn.bc.ca> of Tue, 24 Sep 1996 07:08:20 in
comp.lang.pascal.borland, Adrian Pang <adri...@vcn.bc.ca> wrote:

Quote
>Hi... I am writing a database program that writes all its data into a
>RECORD FILE.  Everyone works fine except when I try to include a header
>in the file - I realized I'll have to put the header on every single
>record!  I don't want to do that.  Does anyone know how to do it without
>putting the header on all the records?  

Make the record a variant one, two varieties, the first a string & the
second your data.  The first [, second ...] record[s] can be used as
header string, and the rest as data,

Quote

>-- Space missing.   Sig too big.
> ****

--
John Stockton, Surrey, UK.  J...@merlyn.demon.co.uk  Turnpike v1.12  MIME
    http://www.merlyn.demon.co.uk/

Other Threads