Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - aheader() return the size of a database header http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 aheader()           Return the size of a database header
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   func uint aheader extern
   param alias sDatabase

 Arguments
   sDatabase is the alias to retrieve information about.

 Return
   The header size of the database.

 Description
   The aheader() function returns the header size of the database file
   associated with the specified alias sDatabase.

   The aheader() function performs identically to the header() function.
   aheader() differs syntactically in that it accepts an alias as a
   parameter.

   This function can be used together with the recsize(), or arecsize() and
   reccount(), or areccount() functions to calculate the required disk space
   of a database file.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   func ulong CopySize
   param alias pDbf
   /*
   This example encodes a CopySize() function, which returns the
   number of bytes required to copy the specified database without
   deleted records (i. e. it is assumed the database will be packed
   prior to the copy).
   */
   vardef
      ulong nDeleteCount
   enddef
   ! pDbf count all for adeleted( pDbf ) to nDeleteCount
   return( aheader( pDbf ) + ;
      ( areccount( pDbf ) * arecsize( pDbf ) ) - ;
      ( nDeleteCount * arecsize( pDbf ) ) )
   endfunc
   
   proc Test_aheader
   open sTest
   ? CopySize( sTest )
   endproc

   proc main
   Test_aheader()
   endproc

See Also: areccount() arecsize() header() reccount() recsize()

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