[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| COPY FILE |-------------------------------------+########################
#| +-----------+ The COPY FILE command copies a file |########################
#| from a source to a target file |########################
#+---------------------------------------------------+########################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------+#####################################
#| COPY FILE <C-exp> TO <C-exp> |#####################################
#+--------------------------------------+#####################################
##############################################################################
##############################################################################
#######+---| Description |--------------------------------------------+#######
#######| COPY FILE will copy open files. If the destination disk is |#######
#######| full, a runtime error results. Use the diskspace() and |#######
#######| filesize() functions before creating the file. |#######
#######| ------------------------------------------------------------ |#######
#######| The COPY FILE command does not use the database engine. It |#######
#######| opens the source file and copies it to the destination file. |#######
#######| This is identical to the DOS copy file command. |#######
#######+--------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Retrive a backup file from a disk. The example |#########
#########| * assumes the current drive is NOT the A: drive. |#########
#########| |#########
#########| IF .NOT. exist( "acct.dbf" ) |#########
#########| ? "Insert backup disk into the A: drive." |#########
#########| ? "Press a key when ready" |#########
#########| CLEAR TYPEAHEAD |#########
#########| get_key() |#########
#########| COPY "a:\acct.dbf" TO "acct.dbf" |#########
#########| ENDIF |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Copy an array of files during an |#########
#########| * installation program. |#########
#########| |#########
#########| VARDEF |#########
#########| CHAR(14) f[5] = "parts","inv","init","help","desc" |#########
#########| ENDDEF |#########
#########| {...} |#########
#########| FOR c = 1 TO 5 |#########
#########| COPY FILE "a:\"+f[c]+".dbf" ; |#########
#########| TO "c:\bbq\"+f[c]+".dbf" |#########
#########| COPY FILE "a:\"+f[c]+".bak" ; |#########
#########| TO "c:\bbq\bak\"+f[c]+".bak" |#########
#########| NEXT |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * This sample allows users to input lists of |#########
#########| * filenames into arrays and copy the |#########
#########| * files to target drives. |#########
#########| |#########
#########| #DEFINE COPY_ARR_SIZE 10 |#########
#########| |#########
#########| VARDEF |#########
#########| CHAR(20) filenames[ ©_arr_size ] |#########
#########| INT r = 0 |#########
#########| CHAR(2) target_drive |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| |#########
#########| ACCEPT "Input target drive: " TO target_drive |#########
#########| REPEAT |#########
#########| ACCEPT "Input filename: " TO filenames[r] |#########
#########| r = r + 1 |#########
#########| UNTIL r >= ©_arr_size .OR. filenames[ r-1 ] = "" |#########
#########| FOR r = 0 TO ©_arr_size - 1 |#########
#########| IF filenames[ r ] = "" |#########
#########| LOOP |#########
#########| ENDIF |#########
#########| COPY FILE filenames[ r ] TO ; |#########
#########| target_drive + filenames[ r ] |#########
#########| NEXT |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
critical
fb_open()
fb_read()
fb_write
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson