Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FlexFile Reference Guide - <b>v_commit()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 V_COMMIT()
 Commit the DOS buffers to disk.
-------------------------------------------------------------------------------
 Syntax

    V_COMMIT( [<nArea> | <cAlias>] )   ->   lSuccess

 Arguments

    <nArea> or <nAlias> is the DBV work area or alias whose buffers
    will be flushed.  Omitting this parameter causes all open DBV file
    buffers to be flushed.

 Returns

    V_COMMIT() returns a (.T.) on success.  Otherwise, it returns
    (.F.).

 Description

    DOS "buffers" disk I/O in order to speed up disk access.  The
    downside to this feature is that the data in the buffers can be
    lost if the machine "hangs" or is powered down before the buffers
    are copied to disk.  This problem was addressed in DOS version 3.3
    and later by allowing a call which forces DOS's buffers to be
    written to disk.  V_COMMIT() makes this call to DOS as described
    below.

    By default, FlexFile automatically commits all DOS buffers after
    every write operation. If you like this behavior, you should never
    need to call V_COMMIT().  This is the safest method but also the
    slowest.  In order to change this default behavior, the
    V_SET_COMMIT() function can be passed a logical (.T.) or (.F.) to
    turn on/off the automatic flushing feature. If automatic flushing
    is turned off, you must call V_COMMIT() explicitly in order to
    flush the DOS buffers as described below.

    If no parameter is passed, V_COMMIT() flushes all open DBV work
    areas to disk.

    If a numeric DBV work area or a character alias is passed,
    V_COMMIT() will flush the buffers associated with the work area
    specified.

       +------------------------ WARNING -------------------------+ 
       | V_COMMIT and V_SET_COMMIT() are based on functions       | 
       | provided in DOS 3.3 and later.  Calls made to these      | 
       | functions on an earlier version of DOS will have no      | 
       | affect.                                                  | 
       +----------------------------------------------------------+ 

 Example

    // Turn off automatic flushing in order to speed up operation.
    V_USE( "temp" )
    V_SET_COMMIT(.f.)

    DO WHILE !EOF()
       IF DELETED()
          REPLACE vlf_fld WITH V_DELETE( vlf_fld )
       ENDIF
       SKIP
    ENDDO
    PACK

    // Flush the buffers and turn automatic flushing back on.
    V_COMMIT()
    V_SET_COMMIT(.T.)

See Also: V_SET_COMMIT() V_REPLACE() V_DELETE()

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