[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+------------+#############################################################
#+-| FILESIZE() |---------------------------------------------+###############
#| +------------+ Returns the size of the specified disk file |###############
#+------------------------------------------------------------+###############
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE system.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |------------------------------+#################################
#| FUNCTION LONG filesize PROTOTYPE |#################################
#| PARAMETERS CONST CHAR file_name |#################################
#+------------------------------------------+#################################
##############################################################################
##############################################################################
#####+---| Description |-------------------------------------------------+####
#####| The filesize() function returns the size of the specified disk |####
#####| file, file_name. If the file does not exist, then 0 is returned. |####
#####+-------------------------------------------------------------------+####
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Do some self-repair on a database. First make |#########
#########| * sure the filesize of the database is what it |#########
#########| * should be according to the number of records in |#########
#########| * the database. |#########
#########| |#########
#########| IF filesize( "test.dbf" ) <> (reccount() * ; |#########
#########| recsize())+header() |#########
#########| DO chk_fields |#########
#########| ENDIF |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Calculate the final size of a database before |#########
#########| * appending records to see if there is enough room. |#########
#########| |#########
#########| #include system.hdr |#########
#########| #include database.hdr |#########
#########| FUNCTION LOGICAL enough_room |#########
#########| PARAMETERS ALIAS dest, ALIAS source |#########
#########| VARDEF |#########
#########| LONG dest_size, source_size |#########
#########| ENDDEF |#########
#########| |#########
#########| save_work_area() |#########
#########| select_dest |#########
#########| dest_size = filesize( dbf()) |#########
#########| select source |#########
#########| source_size = filesize( dbf()) - a_header( source ) |#########
#########| restore_work_area() |#########
#########| RETURN dest_size + source_size > ; |#########
#########| diskspace( curdrive()) |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
curdrive()
diskspace()
find_fsize()
header()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson